Founda’ons of Soware Engineeringckaestne/15313/2017/... · • A decision is a step in the...
Transcript of Founda’ons of Soware Engineeringckaestne/15313/2017/... · • A decision is a step in the...
Founda'onsofSo,wareEngineering
Lecture8:ArchitecturalPa0erns,Tac5cs,andEvalua5onClaireLeGoues
15-313SoAwareEngineering1
LearningGoals
• Understandkeypartsofarchitecturalprocess• Usearchitecturalstylesandtac5csfordesigndecisions• Makejus5fiedarchitecturaldecisionsfornewsystemsandwithinexis5ngsystems• Reviewaproposedarchitecture
15-313SoAwareEngineering2
Traceability-Defini'on
15-313SoAwareEngineering3
"Theabilitytointerrelateanyuniquelyiden5fiablesoAwareengineeringar5facttoanyother,maintainrequiredlinksover5me,andusetheresul5ngnetworktoanswerques5onsofboththesoAwareproductandit'sdevelopmentprocess"–CoEST
TraceabilityinRequirements?
15-313SoAwareEngineering4
Traceability
15-313SoAwareEngineering5
QualityGoal:HighAvailability
Req.:Shouldrunonredundantservers
Architecture:Faultrecoverywithvo5ng
Faultpreven5on:Regularrestarts
OODesign/Impl.:Vo5ngmechanism,
socketcommunica5on
Test:Killingrandomserversintestsetup
TraceabilityCompliance
• Traceabilityrequiredinsomedomains(avionics)– WhydoesXpieceofcodeexist?
• "Enableverifica5onoftheabsenceofundocumentedsourcecodeandverifica5onofthecompleteimplementa5onofthelow-levelrequirements"
• Linktospecifica5onsandtestprocedures
15-313SoAwareEngineering6
TraceabilityandArchitecture• Architecturelinksqualitya0ributestothehigh-levelandlow-levelsystemdesign
• Ensuresqualitya0ributesoAennotevenvisibleincode
• Cost,effort,disciplineneededtocreateandmaintain.– OAenincomplete,incorrect,outdated
• Developershateit,andoAendonotunderstandtheneed.– "Unnecessaryevil"
15-313SoAwareEngineering7
CaseStudy:TheGoogleFileSystem
15-313SoAwareEngineering8
15-313SoAwareEngineering9
Ghemawat,Sanjay,HowardGobioff,andShun-TakLeung."TheGooglefilesystem."ACMSIGOPSopera/ngsystemsreview.Vol.37.No.5.ACM,2003.
Assump'ons• Thesystemisbuiltfrommanyinexpensivecommodity
componentsthatoAenfail.• Thesystemstoresamodestnumberoflargefiles.• Theworkloadsprimarilyconsistoftwokindsofreads:large
streamingreadsandsmallrandomreads.• Theworkloadsalsohavemanylarge,sequen5alwritesthat
appenddatatofiles.• Thesystemmustefficientlyimplementwell-defined
seman5csformul5pleclientsthatconcurrentlyappendtothesamefile.
• Highsustainedbandwidthismoreimportantthanlowlatency.
15-313SoAwareEngineering10
Ghemawat,Sanjay,HowardGobioff,andShun-TakLeung."TheGooglefilesystem."ACMSIGOPSopera/ngsystemsreview.Vol.37.No.5.ACM,2003.
15-313SoAwareEngineering11
Ghemawat,Sanjay,HowardGobioff,andShun-TakLeung."TheGooglefilesystem."ACMSIGOPSopera/ngsystemsreview.Vol.37.No.5.ACM,2003.
Quali'es:ScalabilityReliabilityPerformanceCost
Ques'ons
1. Whatarethemostimportantqualitya0ributesinthedesign?
2. Howarethosequalitya0ributesrealizedinthedesign?
15-313SoAwareEngineering12
15-313SoAwareEngineering13
Ghemawat,Sanjay,HowardGobioff,andShun-TakLeung."TheGooglefilesystem."ACMSIGOPSopera/ngsystemsreview.Vol.37.No.5.ACM,2003.
Quali'es:ScalabilityReliabilityPerformanceCost
Exercise
FortheGoogleFileSystem,createaphysicalarchitectureviewthataddressesarelevantqualitya0ribute
15-313SoAwareEngineering14
15-313SoAwareEngineering15
Sofarincourse
Requirements
Architecture
Implementa5on
Levelsofabstrac'on• Requirements– high-level“what”needstobedone
• Architecture(High-leveldesign)– high-level“how”,mid-level“what”
• OO-Design(Low-leveldesign,e.g.designpa0erns)– mid-level“how”,low-level“what”
• Code– low-level“how”
16 15-313SoAwareEngineering
Whatisarchitecture?
15-313SoAwareEngineering17
Architectureasstructuresandrela5ons(theactualsystem)
Architectureasdocumenta5on(representa5onsofthesystem)
Architectureasprocess(ac5vi5esaroundtheothertwo)
ArchitecturalStylesandTac'cs
15-313SoAwareEngineering18
Architecturalstyle(paMern)
• Broadprincipleofsystemorganiza5on• Describescomputa5onalmodel– E.g.,pipeandfilter,call-return,publish-subscribe,layered,services
• Relatedtooneofcommonviewtypes– Sta5c,dynamic,physical
15-313SoAwareEngineering19
ExampleArchitecturalPaMerns• Systemorganiza5on– Repositorymodel– Client-servermodel– Layeredmodel
• Modulardecomposi5on– Objectoriented– Func5on-orientedpipelining
• Controlstyles– Centralizedcontrol– Event-drivensystems
15-313SoAwareEngineering20
Architecturalstyle(paMern)
• Broadprincipleofsystemorganiza5on• Seereading
15-313SoAwareEngineering21
Source:codeproject.org
Architecturalstyle(paMern)
15-313SoAwareEngineering22
Source:codeproject.org
Client-serverpaMern
• Separa5onofclientsandservers– Serversprovideservices;knownand“stable”– Clientsrequestservices;comeandgo
• Varie5es:synchronous/asynchronous• Impactonsecurity,performance,scalability• Examples:TCP,HTTP,X11
15-313SoAwareEngineering23
15-313SoAwareEngineering24
Client
Server
Database
Wheretovalidateuserinput?
Example:YelpApp
Client-serverstyle
15-313SoAwareEngineering25
Source:wikimediacommons
Layeredsystem
15-313SoAwareEngineering26
Source:eclipse.org
Tieredarchitecture
15-313SoAwareEngineering27
ArchitecturalStyle?
15-313SoAwareEngineering28
Ghemawat,Sanjay,HowardGobioff,andShun-TakLeung."TheGooglefilesystem."ACMSIGOPSopera/ngsystemsreview.Vol.37.No.5.ACM,2003.
Tac'cs• Architecturaltechniquestoachievequali5es– More5edtospecificcontextandquality
• Smallerscopethanarchitecturalpa0erns– Problemsolvedbypa0erns:“HowdoIstructuremy(sub)system?”
– Problemsolvedbytac5cs:“HowdoIgetbe0eratqualityX?”
• Collec5onofcommonstrategiesandknownsolu5ons– ResembleOOdesignpa0erns
15-313SoAwareEngineering29
Manytac'csoutthere!
15-313SoAwareEngineering30
ExampleTac'cDescrip'on:Record/playback• Record/playbackreferstobothcapturinginforma5oncrossinganinterfaceandusingitasinputintothetestharness.Theinforma5oncrossinganinterfaceduringnormalopera5onissavedinsomerepositoryandrepresentsoutputfromonecomponentandinputtoanother.Recordingthisinforma5onallowstestinputforoneofthecomponentstobegeneratedandtestoutputforlatercomparisontobesaved.
15-313SoAwareEngineering31
ExampleTac'cDescrip'on:Built-inmonitors• Thecomponentcanmaintainstate,performanceload,capacity,security,orotherinforma5onaccessiblethroughaninterface.Thisinterfacecanbeapermanentinterfaceofthecomponentoritcanbeintroducedtemporarilyviaaninstrumenta5ontechniquesuchasaspect-orientedprogrammingorpreprocessormacros.Acommontechniqueistorecordeventswhenmonitoringstateshavebeenac5vated.Monitoringstatescanactuallyincreasethetes5ngeffortsincetestsmayhavetoberepeatedwiththemonitoringturnedoff.Increasedvisibilityintotheac5vi5esofthecomponentusuallymorethanoutweighthecostoftheaddi5onaltes5ng.
15-313SoAwareEngineering32
15-313SoAwareEngineering33
15-313SoAwareEngineering34
15-313SoAwareEngineering35
15-313SoAwareEngineering36
15-313SoAwareEngineering37
15-313SoAwareEngineering38
15-313SoAwareEngineering39
Secondandmoredetailedthirdedi5onavailableasebookthroughCMUlibrary.
Manytac5csdescribedinChapter5Briefhigh-leveldescrip5ons(about1paragraphpertac5c)
ArchitectureDesignProcess
15-313SoAwareEngineering40
Whatisarchitecture?
15-313SoAwareEngineering41
Architectureasstructuresandrela5ons(theactualsystem)
Architectureasdocumenta5on(representa5onsofthesystem)
Architectureasprocess(ac5vi5esaroundtheothertwo)
Architecturedesignprocess• Choosepartorwholesystemtofocuson• Understandrelevantrequirements• Chooseanota5on– Typeofview,vocabularyofelements
• Createadesign– Pa0erns,tac5cs
• Evaluate• Govsno-go– Issuesfeedbackintoprocess
15-313SoAwareEngineering42
Architecturedesignprocess
43
Choosescope Understandrelevantrequirements
Chooseanota5on
Create/refineadesignEvaluate
Source:ACDM,ADD
“Go”
Architecturaldecisions
• Heartofarchitecture–decidingwhichpathtogo• Involvetradeoffanalysis• Represen5ngthealterna5vesclearly–halfofwork
15-313SoAwareEngineering44
Architecturaldecisions
• SoAwarearchitectureisdesign
• Adecisionisastepintheprocess– Recordra'onale!(notjustdiagrams)– Tradeoffs– Backtracking
15-313SoAwareEngineering45
“Engineeringdesignis[…]adecision-makingprocess(oCenitera/ve),inwhichthebasicsciences,mathema/cs,andengineeringsciencesareappliedtoconvertresourcesop/mallytomeetastatedobjec/ve”–ABET
Architecturedesignprocess
46
Choosescope Understandrelevantrequirements
Chooseanota5on
Create/refineadesignEvaluate
Source:ACDM,ADD
Architecturaldecisions
• SoAwarearchitectureisdesign
• Adecisionisastepintheprocess– Recordra'onale!(notjustdiagrams)– Tradeoffs– Backtracking
15-313SoAwareEngineering47
“Engineeringdesignis[…]adecision-makingprocess(oCenitera/ve),inwhichthebasicsciences,mathema/cs,andengineeringsciencesareappliedtoconvertresourcesop/mallytomeetastatedobjec/ve”–ABET
Architectureevalua'on• Goal:doesthearchitecturesa5sfyrequirements?
• ATAM–ArchitectureTradeoffAnalysisMethod– Presentrequirements– Presentarchitecture– Analyzearchitecture– Presentresults–risksandnon-risks
15-313SoAwareEngineering48
15-313SoAwareEngineering49
Source:sei.cmu.edu
U'litytree
15-313SoAwareEngineering50
Source:arnon.me
Athena–codereviewsystem
15-313SoAwareEngineering51
Source:JansenandBosch2005
15-313SoAwareEngineering52
Source:JansenandBosch2005
Architecturedesignprocess
53
Choosescope Understandrelevantrequirements
Chooseanota5on
Create/refineadesignEvaluate
Source:ACDM,ADD
Challengesofarchitec'ng
• Describethesystemthatisnotbuiltyet• Domainknowledgeisessen5al• Hugespaceofop5ons• Heavilyreliantonjudgment
15-313SoAwareEngineering54
Howmucharchitecture?
• Designanddocumentwhenneeded,basedonrisk• When:– Beginning– Whenevercircumstanceschange
• Agile
15-313SoAwareEngineering55
Howmucharchitecture?
• YAGNI• Risk• Whentostart:– Beforeimplementa5on– Circumstanceschange
• Whentostop:– Well-defined,requirementsaddressed,passesevalua5on
15-313SoAwareEngineering56
15-313SoAwareEngineering57
Source:BoehmandTurner2003
15-313SoAwareEngineering58
Studentapplica'onsystem
Source:BoehmandTurner2003
15-313SoAwareEngineering59
Mannedspacemissionso,ware
Source:BoehmandTurner2003
Challengesofarchitec'ng
• Describethesystemthatisnotbuiltyet• Domainknowledgeisessen5al• Hugespaceofop5ons• Heavilyreliantonjudgment
15-313SoAwareEngineering60
Summary
15-313SoAwareEngineering61
Architectureasstructuresandrela5ons• Pa0erns• Tac5cs
Architectureasdocumenta5on• Views• Ra5onale
Architectureasprocess• Decisions• Evalua5on• Reconstruc5on• Agile
References• Bass,Clements,Kazman.SoAwareArchitectureinPrac5ce,2013.
• La0anze.Architec5ngSoAwareIntensiveSystems:aPrac55oner’sGuide,2009.
• Clements,Bachmann,Bass,Garlan,Ivers,Li0le,Merson,Nord,Stafford.Documen5ngSoAwareArchitectures:ViewsandBeyond,2010.
• BoehmandTurner.BalancingAgilityandDiscipline:AGuideforthePerplexed,2003.
• JansenandBosch.SoAwareArchitectureasaSetofArchitecturalDesignDecisions,WICSA2005.
15-313SoAwareEngineering62
FurtherReadings• Bass,Clements,Kazman.SoAwareArchitectureinPrac5ce,2013.
• La0anze.Architec5ngSoAwareIntensiveSystems:aPrac55oner’sGuide,2009.
• Clements,Bachmann,Bass,Garlan,Ivers,Li0le,Merson,Nord,Stafford.Documen5ngSoAwareArchitectures:ViewsandBeyond,2010.
• BoehmandTurner.BalancingAgilityandDiscipline:AGuideforthePerplexed,2003.
• JansenandBosch.SoAwareArchitectureasaSetofArchitecturalDesignDecisions,WICSA2005.
15-313SoAwareEngineering63
Levelsofabstrac'on• Requirements– high-level“what”needstobedone
• Architecture(High-leveldesign)– high-level“how”,mid-level“what”
• OO-Design(Low-leveldesign,e.g.designpa0erns)– mid-level“how”,low-level“what”
• Code– low-level“how”
64 15-313SoAwareEngineering
Architecturereconstruc'on
• Goal:describearchitectureofanexis5ngsystemgivenitssourcecode• Difficulty:levelofabstrac5oninprogramminglanguageistoolow• Process:– Itera5ve– Interpre5ve– Interac5ve
15-313SoAwareEngineering65
Reconstruc'onsteps
• Extractrawviews– Toolassistance,sta5c&dynamicanalysis
• Constructadatabase– Aggregatelargevolumesofdata
• Viewfusion– Synthesizeahypothe5calview
• Checkforviola5ons15-313SoAwareEngineering66
Architecturereconstruc'on
15-313SoAwareEngineering67
• Itera5ve• Interpre5ve• Interac5ve
Reconstruc'onsteps
• Extractrawviews– Toolassistance,sta5c&dynamicanalysis
• Constructadatabase– Aggregatelargevolumesofdata
• Viewfusion– Synthesizeahypothe5calview
• Checkforviola5ons15-313SoAwareEngineering68
69Source:BCK13