comp61511 (fall 2018) software engineering concepts in...
Post on 12-Jul-2020
0 Views
Preview:
TRANSCRIPT
1
COMP61511(Fall2018)SoftwareEngineeringConcepts
InPracticeWeek5
BijanParsia&ChristosKotselidis< , @manchester.ac.uk>
(bugreportswelcome!)bijan.parsia christos.kotselidis
2
Let'sLookAtSomeCodeAbitoninversionofcontrolAbitonperformanceanalysis
3.2
ClassesOnewayofthinkingofaclassisasanabstractdatatypeplusinheritanceandpolymorphism.—McConnell,6.1
(Thereareotherwaysofthinkingaboutaclass!)
3.3
ProblemsClassesSolveA isaproblemthatcreationsolvesReasontoCreateaClass
ModellingRealorabstractobjects
ComplexityManagementReduceorIsolateComplexityHidedetails,limiteffects,groupcontrol
OrganisationGroupfunctionality,managevariants,reuse
Youcanalwaysask:Whatproblem?&Isit(well)solved?
3.4
SOLIDPrinciplesOfClassDesignSynthesisedby :BobMartin
SRP Aclassshouldhaveone,andonlyone,reasontochange.
OCP Youshouldbeabletoextendaclassesbehavior,withoutmodifyingit.
LSP Derivedclassesmustbesubstitutablefortheirbaseclasses.
TheSingleResponsibilityPrincipleTheOpenClosedPrincipleTheLiskovSubstitutionPrinciple
3.5
SOLIDPrinciplesOfClassDesignSynthesisedby :BobMartin
ISP Makefinegrainedinterfacesthatareclientspecific.
DIP Dependonabstractions,notonconcretions.
TheInterfaceSegregationPrincipleTheDependencyInversionPrinciple
3.6
SOLIDPrinciplesCreditPrinciple Creator/Coiner
SRP,ISP,DIP BobMartin
OCP BertrandMeyer
LSP BarbaraLiskov
3.7
ClassRelationsFunctionalityisdividedacrossclasses(SRP,ISP)
Howthoseclassesinteractiscritical(ISP,DPSP)TheyworktogetherInacontrolledway(wehope!)(SRP,ISP)
Thinkunitvs.integrationtesting!Viatheirinterfaces
(Some)Kindsofrelations:1. Is-A(Inheritence)2. Has-A(Composition)3.Works-With(Collaboration)
3.8
InheritanceClassAspecializesClassB
ClassAandBsharesomethingPhysically:Code,variables,interfaces...Conceptually:AisakindofB
LSP:anAcansubstituteforaBCallersdon'thavetoknowthespecialisingbehavior
SubclassesextendSuperclassesAddnewmethods
SubclassesoverrideSuperclassesPolymorphism
Criticalanddangerous
3.9
CompositionAlotmoreiswrittenaboutinheritancethanaboutcontainment,but that's because inheritance is more tricky and error-prone, not because it's better. Containment is the work-horsetechniqueinobject-orientedprogramming.
3.10
Composition(2)ClassBis(partly)madeofClassA
AnotsubstitutableforBCertainlynotconceptually
BdelegatessomeaspectstoAPersonhas-anameLetaNameclassmanageStructureofnames
SeeManipulationofnames
falsehoodsaboutnames
Theworldexhibitsfractalcomplexity
3.11
CollaborationClasseshaveresponsibilitiesIndividualclassesmaynotbeself-sufficientOtherclasseswhichhelpfulfiltheresponsibilitiesarethecollaborators
CollaboratorsmaybecoupledtoagreaterorlessordegreeInheritancegenerallyyieldstighercouplingsCompositiongenerallyyieldsmoremoderatecouplingsUsingcollaboratorservicesgenerallyisevenlooser
LSPloosenscouplingsPersonrequiresName
Oranysubclassthereof
3.12
ReadabilityAndUnderstandabilityReadability:easeofcomprehendingthecodeUnderstandability:easeofcomprehendingthesoftwaresystem
Abstractionistheconnection
Recall
4.2
RoutinesOnewayofthinkingaboutaroutineisasanoperationforanabstractdatatype.
Another way of thinking about a routine is as a (typically)named, invocable, block of code with a designatedfunctionality(orpurpose).
RoutinesnameandencapsulatebehaviorAtafinegrainedlevel
Routinesarethesmallestunitofabstraction
4.3
Routines&ClassesClassespackageroutines
RoutinesprovidetheexternalinterfaceRoutinesprovidetheinternalimplementationMixingthesebreaksencapsulation
Thesetofclassroutines(methods)Definethebehaviouroftheclass
4.4
ProblemsRoutinesSolveThemostimportantreasonforcreatingaroutineistoimprovethe
intellectualmanageabilityofaprogram—McConnell,7,Keypoints
ModellingSingleactionsorservices(verbs)
ComplexityManagementReduceorIsolateComplexityHidedetails,limiteffects,groupbehavior,simplify
OrganisationGroupfunctionality,managevariants,reuse
4.5
WhatIsCohesion?..cohesion is ...the workhorse design heuristic at theindividual-routinelevel.
Forroutines,cohesionreferstohowcloselytheoperationsinaroutinearerelated.—McConnell, .7.2
Ultimately,aroutineisablockofcodeI.e.,aseriesofstatementsI.e.,asequenceofLOC
TheformofrelationdeterminesthetypeofcohesionThestrengthoftherelationdeterminestheamount
Atleast,pairwise
4.6
TheGood:FunctionalCohesionRelation:
contributingtoagivenoperatione.g.,performingacalculationenactingabehaviorprovidingaservice
ThreatstofunctionalcohesionIrrelevantorsuperfluouscodeConfusedoperationspecificationPoorfactoringBook-keepingandauxillarybehaviors
Debuggingcode,logging,etc.
4.7
Non-IdealCohesions:UtilitySequential,Communicational,andTemporal
Maybevalidreasonsforaroutine!Issuesarisewhen
Anon-idealcohesionisconfusedforfunctionalcohesionSeekingnon-idealcohesionbreaksfunctionalcohesion
MitigatingthethreatsEnsureallpertinentoperationsarecaptured
Asroutines!Documentthetargetcohesion
4.8
Non-IdealCohesionsSequential
Relation:orderdependencyanddatasharing(withincompletefunctionalconnection)Problems:concealsoperations,couplesroutines,breaksoperation/routinemapping
CommunicationalRelation:datasharing(butnofunctionalconnection)Problems:Concealsandcouplesoperations
TemporalRelation:"simultaneous"execution(nofunc-conn)Problems:Conceals&confusesops;riskscoupling
4.9
PoorOrNon-CohesionsProcedural
SequencingwithoutdatasharingGoodvariant(?),theorchestrator
LogicalFunctionallyunrelatedoperationswithamastercontrolstructureAndit'sgoodvariant,thedispatcher
"Coincidental"Relation:ExistanceinthesameroutineTheanti-cohesion!
4.10
CohesionBetween...A class is a collection of data and routines that share acohesive,well-definedresponsibility.Aclassmightalsobea collection of routines that provides a cohesive set ofservicesevenifnocommondataisinvolved.—McConnell,6
4.11
CohesionBetween...We'vemostlytalkedaboutinternalcohesion
I.e.,relationsbetweenLOCinsidearoutineRoutinesarebundledinclasses
ToisolatedependenciesEsp.shareddataAlso,implementationneedsAlso,book-keeping
ToformacoherentsetofservicesClassesdeterminetheresponsibilities
Wecanperformsimilarcohesionanalysisoveraclass
4.12
CodeCreationIsProblemSolvingTheproblemwe'retryingtosolveisnotlackofcode
ProblemsolvingisapracticalskillYougetbetteratitthemorethatyoudoit
AlotofproblemsolvingismatchingThereisanexistingsolutionthatyourecallTherearesolutionsthatalmostwork
AndcanbemadetooTherearetechniquesthatarelikelyfruitful
Experiencegoesalongway
5.1
Boehm'sEvidence
FollowingslidesderivedfromMakingSoftware,Chapter10
5.2
ReadingPapersThesepapersarechallenging!
EvenmassagedabitforthepractitionerLotsoftechnicaljargonandtechniquesSummarizingavastliteratureChallengingstatsandpresentations
Don'tpanic!ThesearereadandrereadFirstreadingshouldfocusonkeypointsLaterreadingsshouldfocusontheevidence
5.3
TheRoleOfArchitectureKeychallenge(Boehm,MakingSoftware,Chp10)
Howmuchshouldyouinvestinarchitecture?Analogytobuilding
Wepaythearchitect10%ofthecostofabuildingWeshouldspend10%oftheprojectbudgetonarchitecture
Isthisenough?Howwouldweknow?
Note:statisticallygeneralconclusionsmaynotapplyinyourcase!
5.4
Bohem'sResearchQuestions:"Byhowmuchshouldyouexpectthecostofmakingchangesorfixingdefectstoincreaseasafunctionofprojecttimeorproductsize?"
"Howmuchshouldyouinvestinearlyarchitectingandevidence-basedprojectreviewsbeforeproceedingintoproductdevelopment?"
5.5
EconomiesCommoditymanufacturingexhibitseconomiesofscale
Making1chipmaybemuchmoreexpensivethan1000Theunitcostdiminishesasthenumberofunitsincreases
Softwareend-unitcostsare(canbe)zeroCheaptomakeacopy!
Installation&configurationmaynotbeSofocusonlinesofcodeorbitsoffunctionality
SoftwareexhibitsdiseconomiesofscaleTheunitcostrisesasthenumberofunitsincreases
Potentiallyexponential!Pgs166-167esp.useful
5.6
CostRatiosWhat'stheratioofcosttofixearlyvs.late?
1970s1inrequirementsto≈100postdelivery
19811:100forlargecodebases
But1:5forsmall(2,000-5,000LOC)1996survey
(70-125):12000s
Someevidenceofreductionfrom1:100to1:20Orevenflat(for1millionlinecodebase)
5.7
CostRatios(ForCoursework!)What'stheratioofcosttofixearlyvs.late?
Thinkofyourcoursework!Beforedeployment(akasubmission)
SmallfixesarecheapEsp.inthecurrencyofthecourse,i.e.,points
Afterdeployment(akasubmission)Even"small"fixesareexpensive(orimpossible)
Courseworkbuildsoverthesemester!Soproblemscanbuildup
5.8
TwoStrategiesAvoidlatebugsMakefixinglatebugscheaperFailuretodobothkillstheproject
FailuretodoonemaybemitigatedbytheotherAllouractivitiesshouldaimforthis
Thuswewantarchitecturesthatprecludesomebugsconfinetheeffectsofallbugs
5.9
TwoArchitectureBreakers(Pg376)"20%ofthedefectsaccountfor80%ofthecosts"
"these20%are...duetoinadequatearchitecture..."TwosortsofcostsDirectcostsOpportunitycosts
TwoexamplebigfailurestheOSarchitecturedidn'tsupportfail-overwhenprocessorsfailedlackedakeyfunctionality
assumingallmessagesareshortthusborkingon1millioncharactermessages
5.10
TradeOffsMoreupfrontarch
Costs!Runsriskofoverruns
SincelesstimeforeverythingelsePotentially,gettingarchright
Reducesreworktime
Note,changingrequirementscankillgettingitright
5.11
SweetSpots
5.12
Summary(Pg403)"...thegreatertheproject'ssize,criticality,andstability,the greater the need for validated architecture feasibilityevidence.
"veryverysmalllow-criticalityprojectswithhighvolatility,thearchitectingeffortsmakelittledifference"
Note:Thereareothercostdrivers;checktheassumptions!
6.1
ATouchOfManagement
6.2
ScopeJustafewpoints
SoftwareengineeringisvastJustmanagementisvast
3ManagementLoci1. Technical2. Organisational3. People
Otherpeople!You!(Butweputthisunderprofessionalism)
6.3
TechnicalManagementVersionControlandBackups
EvenforyourownprivatestuffAlwaysForyourdissertationtext,SEs,etc.
ConfigurationSystem,tools,environmentKnowhowtogettoacleansystemAuto
Justenoughdocumentation
6.4
MethodologySeeAgileClass
But!Methodologyisn'tapanaceaProcessdoesn'tensureresults"Simpletounderstand,difficulttomaster"
Copout?Haveamethodology
HoweverlightweightandidiosyncraticConsistentpracticesareimprovable
Firstimprovementoninconsistentpractices:Makethemconsistent!
6.5
OrganisationTakeadynamicview
AnimprovingorganisationisdesirableAgoodorganisationisalsodesirableWithincertainbounds,improvingisbetter
Goodnessvs.FitAnorganisationcanbegoodinmanydimensionsButthewrongfitforyouYouneedtoassessboth
Sometimesa"worse"organisationisabetterfit
6.6
WhatProgrammersAreDoing
What(Novice)ProgrammersAreDoing
Chapter26.NoviceProfessionals:RecentGraduatesinaFirstSoftwareEngineeringJob
6.7
6.8
StrengthsAndWeaknesses"""Amongtheirstrengthsare:
ProgrammingReadingandwritingspecificationsDebugging(persistenceandhypothesisgeneration)
Weaknessesinclude:CommunicationsCognitionOrientation(engagingwithalargecodebaseandpreexistingsoftwareteam)"""
Chapter26.NoviceProfessionals:RecentGraduatesinaFirstSoftwareEngineeringJob
6.9
QuestionAsking"Anoverarchingthemeofnewdevelopers’communicationproblemsis
knowinghowandwhentoaskquestionsofothers.
"Ingeneral,novicesdonotaskquestionssoonenough,andoftenstruggletoaskquestionsatanappropriatelevel."
Chapter26.NoviceProfessionals:RecentGraduatesinaFirstSoftwareEngineeringJob
6.10
(Dis)Orientation"Understandinghowteamnormsdifferfromthoseinacademicsettingsconfusedsomesubjects.""Novicesstruggledtocollect,organize,anddocumentthewiderangeofinformationthattheyneededtoabsorb.""Noviceshaddifficultyorientingthemselvesinthelow-informationenvironmentspresentedbytheirprojectteam,codebase,andresources."Somenovicesfeltwoefullyisolatedfromtheirteams,sometimesnotevenknowingallthemembersoftheirteam,andrarelyknowingwhototalktoaboutcertainissues(orwherethatperson’sofficewas)."
6.11
Techno-SocialSkillsTechnicalskillsareimportant
Butdon'ttypicallydominateTechnicalabilitywon'tmakeyouflourish
thoughtheyhelp!Lowinformationenvironments
RequiremasteryofinfofindingSocialskillskey
UnderstandingthesystemandteamsGoodquestionaskingskills
Thetwoshouldblend
7.2
ResponsibilitiesToself
Akeysetofresponsibilitiesistoyourself!Youhavethestrongestandmostfundamentalresponsibilitythere!
ToothersInsideyourcircleInsideyourorganisationWithwhomyouhavecommercialobligations"Theprofession"Societyatlarge
7.3
WideResponsibilities"Smallbugs"leadtosecurityfails
Thatcompromisetheprivacyofmillionsorbillions"Smallinefficiencies""
Hugecarbonfootprint"Harmless"businessmodels
Candistort(orenhance!)societyYouaretheproduct
Softwareproblemscaneasilybecomeglobalproblems
7.4
PersonalVirtuesMcConnelltalksofseveral
(InterestingdiscussioninMakingSoftwareaswell)Mostlyaboutwhatmakesagoodprogrammer
OrteammemberKeyonestoconsider
IntellectualHonestyandHumilityCuriosityHabits
7.5
SoftwareEngineeringIsChallenging!Aswe'veseen!
"Insoftwaredevelopment,evenbasicknowledgechangesrapidly.Thepersonwhograduatedfromcollege10yearsafteryoudidprobablylearnedtwiceasmuchabouteffectiveprogrammingtechniques."—McConnell, .
PartofprofessionalismIskeepingup
BlogsCheckoutatextbookeveryfewyearsDedicatedtimetolearning!
33.8
7.6
SoftwareEngineeringIsChallenging!
7.7
SoftwareEngineeringIsChallenging!Aswe'veseen!
"Olderprogrammerstendtobeviewedwithsuspicionnotjustbecausetheymightbeoutoftouchwithspecifictechnologybutbecausetheymightneverhavebeenexposedtobasicprogrammingconceptsthatbecamewellknownaftertheyleftschool"—McConnell, .
Ageism,sexism,ablism(andseveralother-isms)arebigproblemsparticularlyinCompSciandSoftEng
CSandSEalsoshowagenerousspiritLookatmanyopensourcesoftwareprojects
33.8
7.8
AgeismHeadline:
Headline:Headline:Quote:"Facebook’sMarkZuckerbergtoldtheaudience:“Iwanttostresstheimportanceofbeingyoungandtechnical.Youngpeoplearejustsmarter.”
Headline: <--Keyonetoread!
Howthetechindustry'syouthcultisdrivingolderworkerstoplasticsurgery
TheBrutalAgeismofTechIsSiliconValleyAgeistOrJustSmart?
SiliconValley'sdirtysecret-agebias
7.9
WomanInCS:AStrikingGraph
AnatomyofanEnduringGenderGap
7.10
WomanInCS:AnotherGraph
AnatomyofanEnduringGenderGap
7.11
OutrightHarassment
Allsortsofharassment(andthere'salot)Detailssomedisproportionateeffects
"44%ofmenand37%ofwomen"Sexualisedabuse:21%ofwomen/9%menages18to2953%womenages18to29receivedunsolicitedexplicitimages
"35%ofwomen[16%ofmen]...describetheirmostrecentincidentaseitherextremelyorveryupsetting"
TheInternetProblemWeDon'tTalkEnoughAboutOnlineHarassment2017
7.12
ProfessionalismWeconceiveourselvesasaprofession
Seethe or orWehaveprofessionalstandardsWetakeresponsibility
Creativity,spontaneity,funArenotopposedtoprofessionalism!
BCS ACM IEEE
PythonCommunityCodeofConductGNUKindCommunicationsGuideliens
8.2
Thanks!Fourthtimeforme!
SecondtimeforChristos!!
Wehopeyou'velearnedstuff
Wehave!
8.3
CourseworkYou'vedonealot
CW4stilltocome!Let'stalkaboutthereport
8.4
Exam2hrlimitElectronicAfastpersonshouldtake≈1hrFast!≈doesbest
FinalversionstillmustgothroughmoderationSoIcan'tsayfirmlyButexpect
23+somethingMCQs3-5ShortEssay
8.5
MScProjectsProjectbookwillbecomingoutsoon
Pickprojectsthatchallengeyou!Specialconsiderationsifyou'reinterestedinPhDstudies
Threeprojectsfromme(atleast)potentiallyofinterest:CourseworkToolsGeneratingmultiplechoicequestionsbasedondigitalisedclinicalpathwaysLegalTechProjects
8.6
SUPERFUN!WedisHALLOWEEN!!!
Iwillbedoingsomething!Lotsgoingon!
thisweekendattheVictoriaBaths!!!AweekfromMonday!
Remember,RemembertheFifthofNovememberGuyFawkesnight!Awesomefireworksandgiantbonfires!!
Don'tmissitIrecommendHeatonPark(whichisawesomeanwyay)PlattFieldParkiscloser
Coolmovies
https://tinyurl.com/bonfires2018
8.7
THRILLS.....
8.8
....AndCHILLS!!!!!
top related