comp61511 (fall 2017) software engineering concepts in...

63
1 COMP61511 (Fall 2017) Software Engineering Concepts In Practice Week 4 Bijan Parsia & Christos Kotselidis < , @manchester.ac.uk> (bug reports welcome!) bijan.parsia christos.kotselidis

Upload: others

Post on 16-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

1

COMP61511(Fall2017)SoftwareEngineeringConcepts

InPracticeWeek4

BijanParsia&ChristosKotselidis< , @manchester.ac.uk>

(bugreportswelcome!)bijan.parsia christos.kotselidis

Page 2: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

2

WhateverWorksPrimitiveTechnology:TiledRoofHut

Page 4: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

3.2

WhatIsConstruction?Adefinition:

Software construction is the creation, assembly, ormodification of executable programs typically viamodificationofthesourcecode.

Page 5: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

3.3

AbstractionHierarchyOfASystem

Nottheonlyformulationofsuchahierarchy!

Page 6: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

3.4

ArchitectureVs.Construction

Page 7: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

3.5

CodingAsProblemSolvingSoftwareengineeringisproblemsolving

Hence,thefoundationalnatureofproblemdefinitionWritingormodifyingcode

IsalsoaformofproblemsolvingWehopesmallerproblems.

Protip:Alwaysknowtheproblemyou'resolving!

Page 8: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

3.6

TheBigFour(PlusTwo)Fourprimaryactivities1. Creating

Weneedfunctionality2. Debugging

Weneedcorrectness3. Refactoring(lastweek!)

Weneedcomprehensibility4. Optimising

Weneedefficiency(wrttosomeresource)Plustwo

Testing&Reading

Page 9: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

3.7

TestingIsEverywhereAllprimaryactivitiesinvolvetesting

WhetherformalorinformalE.g.,Creation(whethertestfirstornot)

Page 10: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

3.8

ReadingIsEverywhereReadingcodeisakeyskill

Otherpeople'scodethatyouareusingthatyouaremodifying

Yourowncode!whetherusingormodifying

"Reading"(understanding)systemsisakeyskillGraspingtheproblem,requirements,architectureRelatingcodetothose

Page 13: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

4.2

WhatIs(Code)Creation?Code creation (or coding) is the addition of newfunctionality by the generation of new code and units ofcode

Keyactivity!Oftendirectlymeasured

ProductivityasLOC/day(Though,deletingcodemightbebetter!)

DoesnothavetobeexnihiloCut-paste-modifyreusecountsReusecounts!

Page 14: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

4.3

PrerequisitesRememberthe !

What'syouroverallproblemdefinitionWhatpartareyoutackling

WhatarethepertinentrequirementsUnderstandthearchitecture

AndhowyourcurrentcodefitsinKnowthelocalstandards

E.g.,codeformattingstyle

prerequisites

Page 15: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

4.4

ArchitectureAgoodarchitectureshould:1. helpyoudeterminewhereyourcodeshouldgo2. constrainhowfunctionalityisdivvyedup3. determineyourcommunicationchannels4. giveyouasenseofthingsfittingtogether

thatissharedCode-Architectureconflictsindicate

AproblemwithoneortheotherAlimit

Page 16: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

4.5

TechnologyChoicesDifferenttechnologychoicesaffectcode

LanguageMono-vs.poly-glotTypingregime"Batteries"Mindshareetc.

Frameworks,libraries,OSs,etc.

Page 17: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

4.6

ToolsDevelopmentenvironments

EditorsIDEsSourcecontrol

DynamictoolsCompilersDebuggers&TestersProfilers

StatictoolsLint,syntax,stylecheckersetc.

Page 18: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

4.7

AwarenessesSituationalAwareness

YourperceptionofthecurrentpertinentfactorsfordecisionmakingGoodsituationalawareness

Tracksallpertinentfactorstotherightdegreeinamannertodriveappropraitereactionsatlowcost

DrivestacticsandthusactionUnderstanding

YoursystematicgraspofallfactorsrelatedtodecisionmakingResultsfromsensemakingMorecognitive(indirectlydrivesaction)

Page 19: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

4.8

GettingInTheZoneGivenaproblem,oursolvingcanbe

focusedwehavetightsituationalawarenessthe"situation"istheproblemandsolutionspacewereactratherthanact

unfocusedourawarenessisscattered

distracted/multitaskingdisengagedconfused

The"zone"isamuchhigherproductivitystate

Page 20: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

4.9

AdminRecord-keepingisextremelyhelpful

Andsometimesrequired,e.g.,billablehoursTrackinghelps!(alotcanbeautomated)

TimeEffort(andsenseofeffort)Whatwasdone(andwhy,bywhome)MoodDiscussionsanddecisions

Someisbetterthannone;enoughisbetterstill;thereistoomuch

Page 21: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

4.10

ProgrammerCredosThree Virtues

AccordingtoLarryWall(1),theoriginalauthorofthePerlprogramminglanguage,therearethreegreatvirtuesofaprogrammer;Laziness,ImpatienceandHubris

1. Laziness: The quality that makes you go to great effortto reduce overall energy expenditure. It makes you writelabor-saving programs that other people will find usefuland document what you wrote so you don't have toanswer so many questions about it.

2. Impatience: The anger you feel when the computer isbeing lazy. This makes you write programs that don'tjust react to your needs, but actually anticipate them. Orat least pretend to.

3. Hubris: The quality that makes you write (andmaintain) programs that other people won't want to saybad things about.

(1)Quotedfrom"ProgrammingPerl",2ndEdition,O'Reilly&Associates,1996

Page 23: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

5.2

DefectsAgainRecall:

A defect in a software system is a quality level (for somequality)thatisnotacceptable.

Wefocuson defectsprimarily

ThoughrobustnessisalsokeyMorestability,i.e.,doesn'tcrash

functionalCorrectness

Page 24: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

5.3

WhatIsDebugging?Debugging is the modification of code to remove (ormitigate)correctnessdefects.

Wedon'tcountmissingfunctionalitydefectsDebuggingstartsafterapurporteddetection

Input:aresultoftestingorabugreportWeallowmitigation

NotproperlyfixingthebugButenoughsoit'slessdamagingMuststillinvolvecodemodification

Otherworkaroundsdon'tcount!

Page 25: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

5.4

FunctionalLandscape(Enhanced)

Page 26: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

5.5

DebugCycleInput:Anindicationofadefect

Stabilise—MakereliabilyrepeatableIsolate(orlocalise)—TothesmallestunitExplain—What'swrongwiththecodeRepair—ReplacethebrokencodeTest—Verifythefix

CheckforRegressionsMaskedbugsNearbybugs

Page 27: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

5.6

IndicationAnindicationofadefectisatangiblerecordofabehaviourcontrarytothe(explicitorimplicit)functionalspecificationinadesignatedsituation.

Keyparts:Situation

Preferably,sufficientlydescribedforreplicationExpectedBehaviourWitnessedBehaviour

Typicallywithsomeexplanationwhyit'swrongOftenveryvague

Page 28: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

5.7

Indication?Oftenveryvague

Programcrashedsometimeduringthistest

Actually,onlyon !OpenOfficeonUbuntuwon'tprint

Tuesdays

FromJohnRegehr," "ClassicBugReports

Page 29: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

5.8

StabiliseBugsareoftenverysituationdependent

Preciseinput+stateOS,hardwareSequenceofactionsLengthofoperating

Astabilsedbugisreliablyrepeatablepreferrablywithminimalsufficientconditions

Page 30: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

5.9

Isolate(Localise)Bugsareoftenverylocal

SingleLOCSingleroutineParticularclass

Theydon'thavetobe!Communicationpointsarevulnerable

Adefectisisolatedifyouhaveidentifiedtheminimumsubsystemnecessarytoexhibitthedefectforantriggerinputandsitutation

Page 31: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

5.10

Explain&RepairExplainingthebug

YoucanarticulatethemechanismofthebugYourbugtheory

YoucanmanipulatethebugTriggeroravoiditProducevariantsPredictitsbehaviourFixit

RepairingthebugModifyingthecodesothedefectiseliminatedMaynotbepossible!

Page 32: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

5.11

TestPostfix

YouneedtoverifyYourtheoryYour*executionofthefix

YouneedtoguardagainstUnintendedconsequences!

"New"bugsariseBugsinthefix

ThefixisincompleteThefixtriggersaregression

Maskedbugs

Page 33: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

5.12

CheckNearbyBugscomeinfamilies

SimilarmistakesYoudiditonce,youmighthavedoneittwicePersistentmisunderstandingwithmultiplemanifestations

ClusteredmistakesSomebugshidden

AcrashconcealsmuchSomeroutinesarebroken

Lotsofdebt!Abugisapredictorofmorebugs!

Page 34: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

5.13

BugReportsToWONTFIXSometimes,afixisn'tgoingtohappen

ThebugistoosmallOrinsignificantOrambiguous

ThebugistoobigItwouldchangetoomuchbehavior

WhichsomepeoplerelyonOtherdebtincreasestherisk

Thebutistoohard

Page 36: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

6.2

ResourcesSize

RunningspaceAtalllevesl

PersistenceandtransmissionCode

TimeResponsevs.thourghput

Instantvs.OverallWall/CPUTime/Instructions

Page 37: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

6.3

WhatIsOptimisation?Optmisiationisatransformationofcodeintosufficientlyfunctionally equivalent code that has "better" resourceutilisation.

"Sufficientlyfunctionallyequivalent"Userobservable/desirablebehaviourispreservedUptosomepointItmaybespecialisedtoacertainparticularscenario

ResourceutilisationTypeandPatternmustbespecified

Page 38: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

6.4

Where?

Page 39: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

6.5

TuningTrade-OffsTimeforSpace(andthereverse)PerformanceforReadability(andthereverse)

AndothercomprehensionqualitiesNotalwaysatradeoffforalgorithmicimprovements

OrfatremovalPerformanceforCorrectnessPerformanceforCost

Page 40: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

6.6

TuningAlternativesBuyMoreandFasterHardwareUsetheOptimiserBettercompilers/frameworks/librariesInputmanipulation

"It'sslowwhenIdothis""Don'tdothat!"

Page 41: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

6.7

TuningSafetyTuningisrisky

Evenoptimisationcanberisky!It'seasytomakecodefast

BymakingitincorrectIt'seasytomodifythecodealot

AndnotimproveperformancemuchOrmakeworse

Page 42: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

6.8

TuningAs(Performance)DebuggingInput:Anindicationofaperformancedefect

Stabilise—MakereliabilyrepeatableIsolate(orlocalise)—Tothesmallestunit

USEAPROFILER!TESTCASESARECRITICALExplain—What'swrongwiththecode

Repair—Replacethe"slow"codeTest—Verifytheimprovements

CheckforSufficiency(Wasthatenough?)Trade-offs(e.g.,spaceconsumption)(Correctness)Bugs

Page 43: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

7

ComplexitySlides

Page 44: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

8.1

Boehm'sEvidence

FollowingslidesderivedfromMakingSoftware,Chapter10

Page 45: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

8.2

ReadingPapersThesepapersarechallenging!

EvenmassagedabitforthepractitionerLotsoftechnicaljargonandtechniquesSummarizingavastliteratureChallengingstatsandpresentations

Don'tpanic!ThesearereadandrereadFirstreadingshouldfocusonkeypointsLaterreadingsshouldfocusontheevidence

Page 46: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

8.3

TheRoleOfArchitectureKeychallenge(Boehm,MakingSoftware,Chp10)

Howmuchshouldyouinvestinarchitecture?Analogytobuilding

Wepaythearchitect10%ofthecostofabuildingWeshouldspend10%oftheprojectbudgetonarchitecture

Isthisenough?Howwouldweknow?

Note:statisticallygeneralconclusionsmaynotapplyinyourcase!

Page 47: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

8.4

Bohem'sResearchQuestions:"Byhowmuchshouldyouexpectthecostof

makingchangesorfixingdefectstoincreaseasafunctionofprojecttimeorproductsize?"

"Howmuchshouldyouinvestinearlyarchitectingandevidence-basedprojectreviewsbeforeproceedingintoproductdevelopment?"

Page 48: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

8.5

EconomiesCommoditymanufacturingexhibitseconomiesofscale

Making1chipmaybemuchmoreexpensivethan1000Theunitcostdiminishesasthenumberofunitsincreases

Softwareend-unitcostsare(canbe)zeroCheaptomakeacopy!

Installation&configurationmaynotbeSofocusonlinesofcodeorbitsoffunctionality

SoftwareexhibitsdiseconomiesofscaleTheunitcostrisesasthenumberofunitsincreases

Potentiallyexponential!Pgs166-167esp.useful

Page 49: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

8.6

CostRatiosWhat'stheratioofcosttofixearlyvs.late?

1970s1inrequirementsto≈100postdelivery

19811:100forlargecodebases

But1:5forsmall(2,000-5,000LOC)1996survey

(70-125):12000s

Someevidenceofreductionfrom1:100to1:20Orevenflat(for1millionlinecodebase)

Page 50: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

8.7

CostRatios(ForCoursework!)What'stheratioofcosttofixearlyvs.late?

Thinkofyourcoursework!Beforedeployment(akasubmission)

SmallfixesarecheapEsp.inthecurrencyofthecourse,i.e.,points

Afterdeployment(akasubmission)Even"small"fixesareexpensive(orimpossible)

Courseworkbuildsoverthesemester!Soproblemscanbuildup

Page 51: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

8.8

TwoStrategiesAvoidlatebugsMakefixinglatebugscheaperFailuretodobothkillstheproject

FailuretodoonemaybemitigatedbytheotherAllouractivitiesshouldaimforthis

Thuswewantarchitecturesthatprecludesomebugsconfinetheeffectsofallbugs

Page 52: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

8.9

TwoArchitectureBreakers(Pg376)"20%ofthedefectsaccountfor80%ofthecosts"

"these20%are...duetoinadequatearchitecture..."Twosortsofcosts

DirectcostsOpportunitycosts

TwoexamplebigfailurestheOSarchitecturedidn'tsupportfail-overwhenprocessorsfailed

lackedakeyfunctionalityassumingallmessagesareshort

thusborkingon1millioncharactermessages

Page 53: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

8.10

TradeOffsMoreupfrontarch

Costs!Runsriskofoverruns

SincelesstimeforeverythingelsePotentially,gettingarchright

Reducesreworktime

Note,changingrequirementscankillgettingitright

Page 54: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

8.11

SweetSpots

Page 55: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

8.12

Summary(Pg403)"...thegreatertheproject'ssize,criticality,andstability,the greater the need for validated architecture feasibilityevidence.

"veryverysmalllow-criticalityprojectswithhighvolatility,thearchitectingeffortsmakelittledifference"

Note:Thereareothercostdrivers;checktheassumptions!

Page 58: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

9.3

AbstractDataTypes(1)Adatatypeis

asetofvalueswithassociatedoperations

Anabstractdatatypeisadatatypecharacterisedentirelybytheoperations

independentofimplementationdetailsAconcretedatatype(orimplementationofanADT)is

arepresentationofasetofvalueswithparticularimplementationsoftheoperations

Page 59: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

9.4

ADTExample:Lists

Page 60: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

9.5

ADTExample:IntegersIntegers

AbstractValues:All(orfinatesubsetsof)integersOperations:+,-,*,/,<,=,>

Concrete(representation)32bit2s-complementor64bit2s-complementorarraysorfloats(Javascript)or

Page 62: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

9.7

WhyADTs?Separateinterfaceandimplementation

TheclientonlyneedstothinkabouttheinterfaceUptoapoint!Abstractionsleak

SimplerandclearerFocusesonthesemanticsofthetype

Tellsyouthecriticalfunctionality

Page 63: COMP61511 (Fall 2017) Software Engineering Concepts In ...syllabus.cs.manchester.ac.uk/pgt/2017/COMP61511/... · We allow mitigation Not properly fixing the bug ... Some routines

9.8

UnitsOfCreationA code unit is a syntactically complete(able) chunk of aprogramthatenactssomebehavior.

LineofCodeBlockorcontrolstructureRoutines/procedures/functions/methods/operationsClasses/modulesPackages/modules

Individualroutinesandclassesarewhatgetunittested