software engineering concepts in practice week 1
TRANSCRIPT
COMP61511(Fall2019)SoftwareEngineeringConcepts
InPracticeWeek1
BijanParsia&ChristosKotselidis< ,@manchester.ac.uk>
(bugreportswelcome!)
bijan.parsiachristos.kotselidis
TheFieldSoftwareengineeringaimsto
producesuccessfulsoftwaresystemsviasuccessfuldevelopmentprojects
Programmingisonlyoneaspect!
1 .2
TopicOverviewWelookatdifferenttopics
ThenatureofcomplexsystemsSystemconstruction(coding,debugging,testing,problemdefinition)ProfessionalismandprofessionallifeSocial/ethical/legalissues
(Wemayadjustthetopicsasneededordesired)
1 .3
CourseGoalsThis aimstogivestudentsa
1. astrongconceptualunderstandingofsoftwareengineering2. theabilitytorelatethatconceptualunderstandingtopracticalapplication
3. familiaritywiththesoftwareengineeringscientificandpractionerliterature
sufficienttodriveongoinglearning
courseunit
1 .4
CourseStructureLectures
ActivelearningLabs&Coursework
Makesureyouunderstandthecoursework!Readings
Mostreadingsavailableonline(inoneformoranother)LecturesgobeyondtextsTextsgobeyondlectures
1 .5
TextsPractitioner'stext:
SteveMcConnell,CodeComplete:APracticalHandbookofSoftwareConstructionPhysicalcopiesandavailableasebookin
Researcher'stext:AndyOramandGregWilson(eds),Makingsoftwarewhatreallyworks,andwhywebelieveitPhysicalcopiesandas
Onlinepostsandresearchpapers.
SafariOnline
ebook
1.6
SomeIssuesTheLibrary'se-versionsareratelimited
Limitedconcurrentusersandabout10physicalcopies
1 .7
MitigationsYoucanpurchasethebooks
(£15.92); (£19.89)PrioritiseCodeComplete(forthisclass)
Subscriptionservice10dayfreetrial£39amonth(andcancancel)
CodeComplete MakingSoftware
SafariBooksOnline
1 .8
ANoteOnTheTextsTheyareverygood,but...
...softwareengineeringisnotasettledfield.
Readcriticallyandlookforthemostrecentevidence.
(TheearlychaptersofMakingSoftwarearehelpfulforthis!)
1 .9
AdditionalCoreTextGuidetotheSoftwareEngineeringBodyofKnowledge(SWEBOKGuide)
Free .Notatextbook,butagoodtouchstoneaboutwhataproshouldknowExtensivecoverageandbibilography.Fairlyreadable.Butaguide,notanembodimentoftheBodyofKnowledge
1.10
AssessmentCoursework(50%)
Eachweek,amixture(notalleveryweek)1. MCQquizzes2. Shortessays3. Individualengineeringassignments
PrecisemarkbreakdownvariesExam(50%)
TakenonlineVerylike1&2
1 .11
Materials&BlackboardAllcoursematerialsareavailable
Weuse forCourseworkOnlineforum
Usethis!Subscribe!Wecareandwanttohelp
Exam
onlinehttp://syllabus.cs.manchester.ac.uk/pgt/COMP61511/Blackboard
1 .12
VariantCircumstancesDisability
Equalityactdefinition:isanyconditionwhichhasasignificant,adverseandlong-termeffectonaperson’sabilitytocarryoutnormalday-to-dayactivities.
Exam&StudysupportGreat,helpfulpeople
DisabilityAdvisoryandSupportService
Feelfreetoconsultacourseinstructoraboutthis!We'rehappytoadvise.
1 .13
VariantCircumstancesatemporaryconditionorsituationwhichhasasignificant,adverseeffectonaperson’sabilitytocarryoutnormalday-to-dayactivities
Helpavailablefrom & &yourGPMedical(mentalorphysical)issuesarenottheonlymitigatingcircumstances!
Mitigatingcircumstances
SSO Counsellingservice
1 .14
ANoteAboutAssistanceEarlyinterventionismoreeffective
Ifyouarehavingchallengesofanysortthesoonerknownbyus,thebetterhandled
ThisisverytrueformitigatingcircumstancesIfsomethingisinterfering,documentit!Thereisa"toolate"here!
Again,whenindoubt,askus.
ALLlateworkishandledbythe ,notus.MitCircscommittee
1 .15
ExpectedConductWeexpectofyou(andourselves)
TobefairmindedTotreateachotherwellToavoidacademicmalpracticeTotakeresponsibilityforcoursedutiesTobeengaged,curious,andactive
IfyouhaveaproblemorissuePleaseraiseitwithusIfthatseemsunhelpful,contactyourcoursetutor
1 .16
AcademicMalpracticeWetakeitveryseriously!
Mostcommonforms:Plagiarism&CollusionThe(few)pointsyoucangetaren'tworthlosingyourdegree!Guardagainstthem!
Don'tcut-paste-modifyQuoteandcitetextCiteideasDonotdiscussassignmentswithotherstudents
Usethediscussionboard!
1 .17
Preliminaries
2.1
WhatIsSoftwareEngineering?Theproductionofsoftwaresystemswhether
"standalone"componentsoflargersystems
Mostsoftwareinteractswithvariousformsofhardwareothersoftwaresystemspeople!
Softwareengineeringisincreasinglyseenasabranchofsystemsengineering
2.2
WhatIsSystemEngineering?Systems engineering is amethodical, disciplined approachfor the design, realization, technical management, operations,andretirementofasystem.—NASASystemEngineeringHandbook
2.3
WhatIsSystemEngineering?A “system” is a construct or collection of differentelements that together produce results not obtainable bythe elements alone. The elements, or parts, can includepeople, hardware, software, facilities, policies, anddocuments;thatis,allthingsrequiredtoproducesystem-levelresults.—NASASystemEngineeringHandbook
2.4
WhatIsSystemEngineering?amethodical,disciplinedapproachforthe
design,realization,technicalmanagement,operations,andretirement
ofasystem.
—NASASystemEngineeringHandbook
2.5
WhatIsSystemEngineering?A“system”isaconstructorcollectionof
differentelementsthattogetherproduce
resultsnotobtainablebytheelementsalone.
Theelements,orparts,[include]...allthingsrequired
toproducesystem-levelresults.
—NASASystemEngineeringHandbook
2.6
(Complex)SystemsSystemresultsareemergent
1. Theproblembeingtacklediscomplex,amorphous,orevolving2. Thereisheterogeneityinthecomponentsandhowtheyinteract3. Thesystemdesigntakesintoaccountthewholelifecycle4. Thusthedesignspaceisverylargeandcomplex
2.7
OneViewOfTheDesignSpaceEvenifwe it:supersimplify
OneViewOfTheDesignSpaceIt'snotso :simple
FredBrooks:NoSilverBulletThe complexity of software is in essential property, not anaccidental one. Hence descriptions of a software entity thatabstractawayitscomplexityoftenabstractawayitsessence.
2.10
FredBrooks:NoSilverBulletManyoftheclassicalproblemsofdevelopingsoftwareproductsderived from this essential complexity and its [super]linearincrease[]withsize.
2.11
FredBrooks:NoSilverBulletMuchof the complexity [the software engineer]mustmaster isarbitrarycomplexity,forcedwithoutrhymeorreasonbythemany human institutions and systems to which his interfacesmustconfirm.Thesedifferfrominterfacetointerface,andfromtime to time,not because of necessity but only becausetheyweredesignedbydifferentpeople
2.12
QuestionTime!!TheBoeingDreamlinerrequiresabout
1. 700,000linesofcode.2. 1.7millionlinesofcode.3. 5.7millionlinesofcode.4. 6.5millionlinesofcode.
2 .13
SoftwareCreep(Planes!)Software !takesover
TheF-35 Joint StrikeFighter, scheduled to becomeoperationalin2010,willrequireabout5.7millionlinesofcodetooperateits onboard systems. And Boeing’s new 787 Dreamliner,scheduled to be delivered to customers in 2010, requires about6.5millionlines of softwarecode tooperate itsavionicsandonboardsupportsystems.
2.14
QuestionTime!!Apremium-classautomobileprobablycontains
1. 100,000linesofcode.2. 1millionlinesofcode.3. 10millionlinesofcode.4. 100millionlinesofcode.
2 .15
SoftwareCreep(Cars!)Software !takesover
Theseare impressive amounts of software, yet if youbought apremium-class automobile recently, ”it probably contains closeto100million linesof software code,”... All that softwareexecutes on 70 to 100 microprocessor-based electronic controlunits(ECUs)networkedthroughoutthebodyofyourcar.
2.16
SoftwareCreep(FutureCars!)Software !takesover
Late last year, the business research firm Frost & Sullivanestimated that carswill require200million to300millionlinesofsoftwarecodeinthenearfuture.
2.17
SoftwareCreep(FutureCars!)Software !takesover
Broy estimates that more than 80 percent of carinnovations come from computer systems and thatsoftwarehasbecomethemajorcontributorofvalue(aswellasstickerprice)incars.
2.18
QuestionTime!!Softwarecreepoccursbecause
1. thecostofhardwaregrowsfasterthanthecostofsoftware.2. thecapabilitiesofmechanicalsystemsgrowsslowerthanthecostofsoftware.
3. thecapabilitiesofmechanicalsystemsishardtoimproverelativetothecapabilitiesofsoftware.
4. softwarecanbeupdatedeasily.
2 .19
MillionsOfLinesOfCode!Let'slookatsomecodebasesizes!
AAA
visualisationspreadsheetdiscussion
(Canwebelievetheseestimates?)(Howdoweinterpretthem?)
(WasBrookswrong?)(Weretheseslideswrong?)
2.20
NonComplexSoftwareSystems?Averagingproblem:Writeaprogramthatwillreadinintegersandoutputtheiraverage.Stopreadingwhenthevalue99999isinput.—Soloway
Isaprogramthatsolvesthe"rainfallproblem"1. acomplexsystem?2. partofacomplexsystem?3. asimplesystem?
2.21
Lab1About1hr
We'llplayitabitbyearLabmaterialsareonline
LongURL:
ShortURL:http://studentnet.cs.manchester.ac.uk/pgt/COMP61511/labs/lab1/
bit.ly/wk1lab1
2.22
ProblemComplexity
3.1
FizzBuzzBuzzMostgoodprogrammersshouldbeabletowriteoutonpaperaprogramwhichdoesthisinaunderacoupleofminutes.
Wanttoknowsomethingscary?–themajorityofcompscigraduates can’t. I’ve also seen self-proclaimed seniorprogrammerstakemorethan10-15minutestowriteasolution.
—ImranGhory
3.2
FizzBuzzButIamdisturbedandappalledthatanyso-calledprogrammerwouldapplyforajobwithoutbeingabletowritethesimplestofprograms. That's a slap in the face to anyone who writessoftwareforaliving.
—JeffAtwood
Isthisagoodattitude?
3.3
FizzBuzzUs!29studentsenrolled24ontimesubmissions22.zip(1.jpg,1.py)
4wronglynamed!(e.g.,`Bijan_Parsia_Lab0.zip)3didn'tunziptoadirectory(1alsowrongnamed)16/24=72%!
5were"eyeball"detectablywrong
45%successrate!!!
Let's !look
3.4
FizzBuzzGolf!Wehad5plasyers(outof22submissions)Sizesrangedfrom83(thewinner!)to533Winner!
for i in range(1, 101): print((not i % 3) * "Fizz" + (not i % 5) * "Buzz" or i)
Lastyear's: for i in range(1,101): print('Fizz'[i%3*4:]+'Buzz'[i%5*4:]or i)
3.5
FizzBuzzCritiqueHere'saclueforyou:Idon'tdowellinprogrammingtasksduring interviews, and I've love someone to come into mycommentsandtellmeIcan'tprogrambasedonthisevent.No,I've only faked it while working for Nike, Intel, Boeing, JohnHancock,LawrenceLivermore,andthrough14orsobooks–nottomention6yearsofonlinetechweblogging.
—ShelleyPowers
3.6
FizzBuzzCritique2In fact,you'll finda lotofpeoplewhodon'tnecessarilydowellwhen it comes to programming tasks or other complex testingduringjobinterviews.Why?Becausethepartofyourbrainthatmanagescomplexproblemsolving tasks is the first that'smoreor less scrambled in high stress situations.Themore stress,themorescrambled.Themorestressedweare,themoreournatural defensive mechanisms take over, and the less energyfocusedintohighercognitiveprocesses.
—ShelleyPowers
3.7
FizzBuzzComplexityOfthequestionitself
WhatconstructsdoesFizzBuzzrequire?Whatkindoferrorscan(reasonably)happen?
OftheuseofthequestionWhatcanweconcludeaboutaFizzBuzzfailure?Areenvironmentalfactorssignificant?DoeswidespreadawarenessofFizzBuzzquestionsinvalidatethem?
3.8
TheRainfallProblem(Results)
—DoWeKnowHowDifficulttheRainfallProblemis?
3.9
RainfallComplexity
—TheRecurringRainfallProblem
3.10
RainfallSolutiondef average_rainfall(input_list): # Here is where your code should go total = 0 count = 0 for m in input_list: if m == -999: break if m >= 0: total += m count += 1 # ignore other negatives avg = 0 if count == 0 else total / count return avg
3.11
WatOr"HiddenComplexity"
3.12
FredBrooks:NoSilverWatMuchof the complexity [the software engineer]mustmaster isarbitrarycomplexity,forcedwithoutrhymeorreasonbythemany human institutions and systems to which his interfacesmustconfirm.Thesedifferfrominterfacetointerface,andfromtime to time,not because of necessity but only becausetheyweredesignedbydifferentpeople
3.13
TestingCorrectnessBeware of bugs in the above code; I have only proved itcorrect,nottriedit.—DonKnuth,Figure6:page5ofclassroomnote
4.1
ReallyBewareOfBugs!
—GraceHopper'sBugReport
4.2
DeveloperTestingWecandistinguishbetween
Testingdonebynon-specialists(McConnell:"Developertesting")
Formanyprojects,theonlysort!Testingdoneby(test)specialists
IfyoucompileandrunyourcodeThenyou'vedoneatest!(ormaybetwo!)
Ifonlya"smoke"test
Testingisinescapable;goodtestingtakeswork
4.3
QuestionTime!Ifyoucompileyourcode
1. youhavetesteditforsyntacticcorrectness.2. youhavetesteditforsemanticcorrectness.3. youhavetesteditforboth.4. youhaven'ttesteditatall.
4 .4
WhatIsATest?Atestcase is arepeatable execution situation of a softwaresystem that produces recordable outcomes. A test is aparticularattemptofatestcase
4.5
WhatIsATest?Theoutcomesmaybeexpected
E.g.,weexpectpassing1+1toacalculatortoreturn2Generallybooleanoutcomes(passorfail)
WemighthaveanerrorthatpreventscompletionTheoutcomesmaybemeasurementresults
E.g.,wewanttofindthetimeittakestocompute1+1
4.6
WhatIsATest?(3)Theoutcomesshouldtestifytosomesoftwarequality
E.g.,correctness,butalsoefficiency,usability,etc.A(single)testspecifiesaveryparticularquality
E.g.,correctforagiveninputE.g.,usesXamountofmemoryforthisscenario
Thefundamentalchallengeoftestingisgeneralisability
4.7
GeneralisabilityProblem(1)Testingshowsthepresence,nottheabsenceofbugs.—Edsger W. Dijkstra, Nato Software Engineering Conference,pg161969
4.8
WhatIsATestCase?Atestcaseisaspecifiedinputwithanexpectedoutput;iftheprogram being tested gives, for the given input, an outputequivalent to the expected one then that test has passed;otherwisefailed.
4.9
TerminologyNoteTestandtestcaseareoftenusedinterchangeably
AndinotherloosewaysMostofthetimeitdoesn'tmatterbecauseeasytodistinguish
WeoftentalkaboutatestsuiteortestsetButthisalsomightbesubordinatedtoatestForexample,
"Weused the followingtestsuite tostresstest ourapplication".
4.10
GeneralisabilityThreatAtestcase(A):
Goal:CorrectnesstothespecificationInput:apairofintegers,X and YOutput:theintegerthatistheirsum
TestInput:X=1andY=1Expectedoutput:2
TestresultofSystemSispassWhatcanweconclude?
4.12
QuestionTime!FromthetestresultPasstestcaseA,wecanconcludethat:
1. SystemScorrectlyimplementsthespecification.2. SystemScorrectlyimplementsthespecificationforthisinput
3. Both1and24. Neither1nor2
4.13
QuestionTime!FromthetestresultFailtestcaseA,wecanconcludethat:
1. SystemSdoesnotcorrectlyimplementthespecification.2. SystemSdoesnotcorrectlyimplementthespecificationforthisinput
3. Both1and24. Neither1nor2
4.14
EnvironmentMattersThe next most significant subset of [Modification Requests(MRs)] were those that concern testing (the testingenvironmentandtestingcategories)—24.8%oftheMRs....itisnot surprising that a significant number of problems areencountered in testing a large and complex real-timesystem...First, thetestingenvironment itself isa largeandcomplex system thatmust be tested. Second, as the real-time system evolves, so must the laboratory testenvironmentevolve.MakingSoftware,pg.459.
4.16
AGoodTestAgoodtestcaseis
partofasuiteoftestcasesunderstandable
i.e.,youcanrelateittothespectothesystembehavior
fitsinwiththetestenvironmentis(giventhesuite)informative
4.17
WordCount(wc)wcisaubiquitoussmalltool
GoesbacktoatleastStillinactiveuse
Thiswillbeourgotoexampleforawhile!Esp.inthelab!
1971
4.19
WordCountTestingCreateyourownPythonversionofWCWithaspecificationbasedontheoriginaldoneman wc
doesitcovereverything?howcantestagainsttheexactspec?ReverseEngineeringtotherescue!
4.21
WCReverseEngineeringReverse engineering is the process ofanalyzing a subjectsystem to identify the system's components and theirinterrelationshipsandtocreaterepresentationsofthesysteminanotherformoratahigherlevelofabstraction.-IEEE
4.22
Let'sStartWithSomethingSmallWhataboutanemptyfile?
Spec1:iftheinputofwcisanemptyfile,itreturns0foralloutputsNote:Definedinput,Expectedoutput
4.23
BuildingTheSpecificationByreverseengineeringwcwe:
understandbetterthebehaviorofourprogramarebuildingthespecificationdesignourtestcases!
Whatifwebuildnewsoftware?CustomerspecificationAgileorBUFRrequirementsgathering
4.25
DesigningTestsNotatrivialprocessNumerousparameterstofactorinCommoncasevsCornercasesCanwetesteverything?
InprincipleNo,henceappropriatetestselectioniskeytosuccessBewareofTrade-offsTestcoveragevsExecutionTimevsResources
4.26
DoctestDocTestisaunittestingframeworkforPython
Willbeusedduringoutlabsessions!Providesaneasy-to-useandmodularinterfacefor:IsolatedTestingRegressionTestingOrextendedforallkindsoftesting(almost!)
Moreonthelabthisafternoon!
4.27
SimpleExample # Everything is in a docstring!""">>> 1+12>>> 1+1 #Note that the supplied expected answer is *wrong*. This test will fail3>>> [1, 2, 3][1]2"""
# We add the boilerplate to make this module both executable and importable.if __name__ == "__main__": import doctest # The following command extracts all testable docstrings from the current module. doctest.testmod()
4.28
UnitTestingWC>>> import subprocess>>> subprocess.check_output('wc test1.txt', shell=True)b' 10 10 20 test1.txt\n'
4.29
Qualities(Or"Properties")Softwarehasavarietyof
Size,implementationlanguage,license...Userbase,usersatisfaction,marketshare...Crashingness,bugginess,performance,functions...Usability,prettiness,slickness...
characteristics
5.2
"Quality"OfSuccessSuccessisdeterminedby
thesuccesscriteriai.e.,thenatureanddegreeofdesiredcharacteristics
whetherthesoftwarefulfilsthosecriteriai.e.,possessesthedesiredcharacteristicstothedesireddegree
5.3
InducingSuccessWhilesuccessisdeterminedbyqualities
thedeterminationisn'tstraightforwardthedeterminationisn'tstrict
forexample,luckplaysarole!itdependsonhowyouspecifythecriticalsuccessfactors
5.4
SoftwareQualityLandscape20.1.CharacteristicsofSoftwareQuality
5 .5
ExternalVs.Internal(RoughThought)Externalqualities:
McConnell:those"thatauserofthesoftwareproductisawareof"Internalqualities:
"non-externalcharacterisitcsthatadeveloperdirectlyexperienceswhileworkingonthatsoftware"
Boundaryvarieswiththekindofuser!
5 .6
ExternalDefinitionExternalqualities:
McConnell:those"thatauserofthesoftwareproductisawareof"Thisisn'tquiteright!
Ausermightbeawareoftheimplementationlangauge"characteristicsofsoftwarethatauserdirectlyexperiencesinthenormaluseofthatsoftware"?
5.7
InternalDefinitionInternalqualities:
"non-externalcharacterisitcsthatadeveloperdirectlyexperienceswhileworkingonthatsoftware"Intuitively,"underthehood"
5.8
External:FunctionalVs.Non-FunctionalFunctional≈Whatthesoftwaredoes
BehaviouralWhatdoesitaccomplishfortheuserPrimaryrequirements
Non-functional≈HowitdoesitQualityofservice
Therecanberequirementshere!Ecologicalfeatures
5.9
KeyFunctional:CorrectnessCorrectness
Freedomfromfaultsin
spec,design,implementation
DoesthejobFulfillsalltheusecasesoruserstories
Implementationanddesigncouldbeperfect,butiftherewasaspecmisunderstanding,ambiguity,orchange,thesoftwarewillnotbecorrect!
5 .10
External:"QualitiesOfService"Usability—cantheusermakeitgoEfficiency—wrttime&spaceReliability—longMTBFIntegrity
Corruption/lossfreeAttackresistance/secure
Robustness—behaveswellonstrangeinput
Allthesecontributetotheuserexperience(UX)!
5 .11
Internal:TestabilityAcriticalproperty!
RelativetoatargetqualityAsystemcouldbe
highlytestableforcorrectensslowlytestableforefficiency
PartlydeterminedbytestinfrastructureHavinggreathooksfortestspointlesswithouttests
5.12
Internal:TestabilityPracticallyspeaking
LowtestabilityblocksknowingqualitiesTest-basedevidenceisessential
5 .13
QualityInteractions:External20.1,CodeComplete
5.14
Coursework!Therearefourbitsofcoursework
Readings(see )andthelabpagesAshortMultipleChoiceQuestion(MCQ)Quiz(Q1)relatedto(someofthe)readingsAshortEssay(SE1)relatedtoareadingAprogrammingassignment(CW1)
materialspage
6.1
Coursework!Q1&SE1aredueatthestartofnextclass(Friat9:00)CW1isdueonThursat19:00<--Thedaybefore!!!Totalof20points
5forQ1and5forSE110forCW1
6.2
PleaseDon'tStress!It'snotalotofwork
SoifyouarelearningPythonyoushouldhavetime!It'spartlyfordiagnosisPartialworkcountsWe'reheretohelp!Don'tleavebeforebeingsureyouknowwhatyou'redoing
6.3
PleaseWorkAlone!It'simportanttofigureoutwhatyoucandoTheseareasmallnumberofpointsandCW1isfairlysimpleWe'reheretohelp!UsetheBlackboardforum!
WewillmonitorDon'tsharecodethereYoucanshare"highleveltips"
6.4