软件体系结构体系结构评审Architectural Reviews.ppt
软件体系结构体系结构评审ArchitecturalReviews,孙志岗sun,sun,2,2020/5/12,ArchitecturalReviews,Architecturalreviewsareakeystepinarchitecture-baseddevelopment.Theyincludeamethod(suchasSAAMorATAM),butthefullpracticeincludesmorethanthat.体系结构评审是开发过程中的一个重要环节。有专门的评审方法(SAAM、ATAM),但在实践中并不仅仅是这些Wewilldiscusscost/benefitsofarchitecturalreviewsdifferentarchitecturalreviewtechniquespreconditionsforanarchitecturalreviewarchitecturalreviewactivitiesoutputsfromanarchitecturalreview,sun,3,2020/5/12,CostsofArchitecturalReviews,Therearethreedifferenttypesofcostsofholdingregulararchitecturalreviews.directstaffcosts直接员工开销organizationaloverhead组织管理开销indirectstaffcosts间接员工开销,sun,4,2020/5/12,ExamplesofDirectStaffCosts,ATeachhasadifferentcostandprovidesdifferentinformation.有很多种评审技术。每种需要不同的开销,提供不同的信息Thesetechniquesfallintooneoftwocategories.questioningtechniques:appliedtoevaluateanyaspectofanarchitectureforanygivenreason提问技术:用来评价体系结构的任何方面measuringtechniques:appliedtoanswerquestionsaboutaspecificquality度量技术:回答关于某项质量的问题,sun,15,2020/5/12,QuestioningTechniques,Scenario-basedtechniquesdescribesaspecificinteractionbetweenstakeholdersandasystem描述角色与系统交互的过程example:SAAM,ATAM(partially)Questionnaire-basedtechniques(基于问卷的技术)Somequestionsapplytoallarchitectures(especiallythoseinasingledomain).有些问题被用于所有的体系结构,尤其是在单一领域内Somequestionsaskaboutdetailsofaspecificarchitecture.有些问题询问一个特定结构的细节Someaskaboutthedevelopmentprocess.“Isthereasinglearchitect?”“Howdoyouensureconformance?”“你们怎样保证一致性?”,sun,16,2020/5/12,QuestioningTechniques,Questionnairesarereused;theyreflectmorematurityorexperiencewithinadomain.问卷可以重用;它们体现了在一个领域内的成熟度和经验是否丰富Scenariosmustbedevelopedanewforeachsystem.场景必须为每个系统重新开发,sun,17,2020/5/12,MeasuringTechniques,Metrics:quantitativeinterpretationsofobservablemeasures量度:可测质量的定量说明complexitymetricsidentifyareaswheremodificationsmaybedifficult复杂度的测量指明在哪个区域修改会很困难performancemetricssuggestareaswherebottlenecksmayoccur性能的测量提示瓶颈会在哪里发生Reviewstendtofocusonresultsofmetrics度量的结果assumptionsunderlyingtheinterpretationofthemetrics(e.g.,assumedeventdistribution)对度量的解释中的潜在假定,sun,18,2020/5/12,MeasuringTechniques,Simulations,prototypes,experiments:domainspecificmodelsofanarchitectureorperformancemodel仿真、原型、实验:建立体系模型或者性能模型areexpensivetocreateoftenexistaspartofdevelopmentanywayMayanswerissuesraisedbyquestioningtechnique可以回答提问技术提出的问题“Whatevidencedoyouhavethatperformanceisadequate?”“你凭什么说可以达到这个性能?”,sun,19,2020/5/12,PropertiesofReviewTechniques,sun,20,2020/5/12,ReviewProcess,Anarchitecturalreviewhasthreemajorelements.preconditions:thesetofnecessaryassetsandconditionsthatmustbeinplacebeforeareviewcanbeperformedsuccessfully前提:评审成功进行之前,必要的资源和条件必须到位activitiesofthereviewitself活动:评审本身outputs:thereportofreviewresults输出:评审结果报告,sun,21,2020/5/12,ReviewPreconditions,Understandthecontextofthereview理解评审的上下文Assembletherightpeople集合正确的人Setorganizationalexpectationsandsupport期望和支持Prepareforreview为评审做准备Obtainrepresentationofthearchitecture获得体系结构文档,sun,22,2020/5/12,Preconditions:Context,Plannedreviewpartofnormaldevelopmentactivity正常开发活动的一部分non-adversarial(非敌对性的)scheduledwellinadvance(事先安排好日程)builtintoprojectsscheduleandbudget包含在项目日程和预算之内Unplannedusuallyoccurswhenprojectisintrouble通常在项目出现问题时采用oftendevolvesintofinger-pointing导致互相责备canbepainfulforprojectalreadystruggling对于已经苦苦挣扎了很久的项目而言,有些痛苦,sun,23,2020/5/12,Preconditions:Context,Timingofthereviewearly“architecturediscoveryreview”isdoneafterrequirementsareset,butbeforethearchitectureisfirm需求分析之后,体系结构还没有确定之前进行isusedtounderstandimplicationsofrequirementsonarchitecture用来理解需求在体系结构方面的隐含内容checksforrequirementsfeasibility(检查需求的可行性)prioritizesarchitecturalgoals(为质量目标排序)fullarchitecturalreviewisdonewhenarchitecturaldocumentationisavailable体系结构文档可用时进行isusedtoevaluatequalitiesofproposedarchitecture评价被评体系结构的质量,sun,24,2020/5/12,Preconditions:People,Representativesofproject(项目代表)architectdesignersofmajormodulesstakeholdersrepresentativesReviewteammembers(ideally,aseparateunit)评审团成员(理想情况下是一个独立组织)atleastonedomainexpertincluded至少有一个领域专家someonetohandlelogistics(e.g.,meetingrooms,supplies)后勤人员(会议室、茶水、食品)librariantoorganizedocumentation文档管理员“apprenticereviewer”forgrowth成长中的评审员学徒,sun,25,2020/5/12,Preconditions:ReviewTeam,Thereviewteammustbeassembledsothatmembersareperceivedasimpartial,objective,andrespected成员要公正、客观和被尊重membersdevotetheirfull-timeefforttothereview成员全心加入评审membersarefluentinarchitectureandarchitecturalissues成员要训练有素而且口才好itislocatedclosetoartifactsbeingexamined有足够的权限检查被评审材料,sun,26,2020/5/12,Preconditions:ReviewTeam,Theteammusthaveaccesstoapplicabledomainknowledge(perhapsviaconsultantstotheteam)适当的领域知识designdocuments设计文档reviewcriteria评审标准supportstaff支持人员,sun,27,2020/5/12,Preconditions:OrganizationalExpectations,Acontractbetweenthereviewteamandthesponsorofthereviewmustbeestablished.Whowillbetoldwhatuponcompletion?结束后,哪些内容可以被告诉哪些人Whatwill(not)bethereviewcriteria?什么是(不是)评审标准?What/whowillbemadeavailabletoteam?哪些人和物是评审团可以使用的?Whatfollow-upisexpected?希望评审的结果如何?Howlongwillthereviewtake?要评审多久?,sun,28,2020/5/12,Preconditions:OrganizationalExpectations,Organizationalcultureandsupportmustbeconsidered.Arereviewspartofthestandardprojectlifecycle?评审是项目的基本生命周期的一部分吗?Isservingonareviewteamconsideredgoodforonescareer?为评审团服务是份好差事吗?Willtheorganizationallowitssuperiordesignerstimeofffromtheirprojectstoserveonreviewteams?企业允许它的高级设计师把他的项目放在一边来参加评审吗?Isthereastandingrevieworganization(eventhoughmembersmayrotateonandoff)?有常设的评审组织吗(即便成员常进进出出)?,sun,29,2020/5/12,Preconditions:Read-AheadMaterial,Forprojectbeingreviewedquestionnairesscenarios(Thesearecreatedaspartofthereview,buttimeshouldbeallowedforprojectmemberstodigesttheinformation.)ForreviewteamdescriptionofarchitecturerationaleforarchitectureIdeally,materialwilladdressthereviewquestions.(Passingthistestbecausethequestionswereknowninadvanceisnotcheating,butgoodengineering!)理想情况,材料要能说明评审时的问题,sun,30,2020/5/12,Preconditions:RankedQualityandBehavioralRequirements,Plantoexaminethreetofivequalityandbehavioralrequirements.计划检查3到5个质量和行为需求Aparticularrepresentationmedium(language)forthearchitectureisnotnecessary.Aslongastheinformationcanbeextracted(usingprojectmembersasnecessary),theformoftherepresentationisnotimportant.一个专门的体系结构表述媒体(语言)目前并不是必须的。由项目成员来讲解信息,表述的形式并不重要,sun,31,2020/5/12,ReviewActivities,Evaluate“Run”thescenariosandaskthequestions,oranswertheitemsinthechecklist.按场景执行,并询问相关问题;或者回答问卷里的问题Performtheexperiments.(演示实验)Executetheprototypesorsimulations.运行原型或仿真程序Recordcriticalissueshighlightedinthereview评审中发现的严重问题commentsofprojectmembersontheseissues项目成员对这些问题的说明,sun,32,2020/5/12,ReviewActivities,Ranktheissuesproject-threatening(生死攸关)majorminorEachissueraisedshouldbeaddressedintermsofchangingthearchitecturerelaxingtherequirements,sun,33,2020/5/12,ReviewActivities,Warningsignsarchitectureforcedtomatchorganization组织模式影响体系结构top-levelcomponentsnumberover25顶层组件数超过25个onerequirementdrivesentiredesign一项需求决定整个设计architecturedependsonalternativesintheoperatingsystem体系受操作系统选择的影响,sun,34,2020/5/12,ReviewActivities,Warningsignschoiceofsoftwarecomponentsisdictatedbyhardwarepersonnel由硬件人员选择软件组件redundancynotneededforreliability面对可靠性时,不考虑冗余手段designisexceptiondriven零散的小的事件影响设计noidentifiablearchitect没有确定的架构师,sun,35,2020/5/12,OutputfromReview,SetofrankedissuessupportingdatacontainedinformalreportfeedbacktoprojectEnhancedsystemdocumentation增强的系统文档Setofscenariosforfutureuse将来会用到的场景集Identificationofpotentiallyreusablecomponents认定潜在的可重用组件Estimationofcostsandbenefits估算成本和收益,sun,36,2020/5/12,SAAM:SoftwareArchitectureAnalysisMethod一种简单的基于场景的评审技术,sun,37,2020/5/12,QualitiesAreTooVagueforAnalysis,Isthefollowingsystemmodifiable?这个系统具有适应性吗?Backgroundcoloroftheuserinterfaceischangedmerelybymodifyingaresourcefile.通过修改资源文件,可以改变界面的背景色Dozensofcomponentsmustbechangedtoaccommodateanewdatafileformat.必须修改许多组件才能适应新的文件格式Areasonableansweris一个合理的答案:yeswithrespecttochangingbackgroundcolor有,从改变背景色的角度来看nowithrespecttochangingfileformat没有,从改变文件格式的角度来看,sun,38,2020/5/12,QualitiesAreTooVagueforAnalysis,Qualitiesonlyhavemeaningwithinacontext.质量因素只在一定的上下文里才有意义SAAMspecifiescontextthroughscenarios.SAAM通过场景指定上下文,sun,39,2020/5/12,Scenarios,Ascenarioisabriefdescriptionofastakeholdersinteractionwithasystem.场景就是一个角色与系统交互过程的简单描述Whencreatingscenarios,itisimportanttoconsiderallstakeholders.建立场景的时候,一定要考虑到所有的角色Customer、User、Developer、Maintainer、AttackerThescenariosthatareofmostinterestinaSAAMevaluationarechangescenarios.SAAM最关心的是变化场景,sun,40,2020/5/12,StepsofaSAAMEvaluation,Identifyandassemblestakeholders确认和召集角色Developandprioritizescenarios制定场景,并排好优先级Describecandidatearchitecture(s)描述候选的体系结构Classifyscenariosasdirectorindirect把场景分类为直接场景和间接场景Performscenarioevaluation进行场景评估Revealscenariointeractions展现场景间的相互影响Generateoverallevaluation整体评估,sun,41,2020/5/12,Step1:IdentifyandAssembleStakeholders,sun,42,2020/5/12,Step1:IdentifyandAssembleStakeholders,sun,43,2020/5/12,Step1:IdentifyandAssembleStakeholders,sun,44,2020/5/12,Step2:StakeholdersDevelopandPrioritizeScenarios,Scenariosshouldbetypicalofthekindsofevolutionthatthesystemmustsupport:场景应该是系统必须支持的各种演化的典型:functionalitydevelopmentactivitieschangeactivitiesScenariosshouldrepresenttasksrelevanttoallstakeholders.所有角色都应该能在场景中体现出来Ruleofthumb:10-15prioritizedscenarios应该有10-15个优先的场景,sun,45,2020/5/12,Step3:DescribeCandidateArchitectures,Itisfrequentlynecessarytoelicitappropriatearchitecturaldescriptions.通常,对体系结构进行适当的描述是非常重要的Structureschosentodescribethearchitecturewilldependonthetypeofqualitiestobeevaluated.以我们需要的质量为依据,选择用来描述体系结构的结构,sun,46,2020/5/12,Step4:ClassifyScenarios,Therearetwoclassesofscenarios.Directscenariosarethosethatcanbeexecutedbythesystemwithoutmodification.直接场景是那些不需要修改系统就能执行的场景Indirectscenariosarethosethatrequiremodificationstothesystem.间接场景是那些需要修改系统的场景Theclassificationdependsuponboththescenarioandthearchitecture.场景的类型因系统而异Forindirectscenarioswegaugetheorderofdifficultyofeachchange:e.g.aperson-day,person-week,person-month,person-year.对间接场景,我们要度量适应每个变化的难度(工作量),sun,47,2020/5/12,Step5:PerformScenarioEvaluation,Foreachindirectscenarioidentifythecomponents,dataconnections,controlconnections,andinterfacesthatmustbeadded,deleted,ormodified明确其组件、数据连结件、控制连结件和要被增加、删除或修改的接口estimatethedifficultyofmodification估算修改的难度Difficultyofmodificationiselicitedfromthearchitectandisbasedonthenumberofcomponentstobemodifiedandtheeffectofthemodifications.修改的难度体现在被修改的组件个数和修改的效果Amonolithicsystemwillscorewellonthisstep,butnotonnextstep.只有一个模块的系统在此项评估可以得到高分,但是,sun,48,2020/5/12,Step6:RevealScenarioInteractions,Whenmultipleindirectscenariosaffectthesamecomponents,thiscouldindicateaproblem.当多个间接场景影响同一个组件时,可能引发问题couldbegood,ifscenariosarevariantsofeachother可能是好事,当场景是彼此的变体changebackgroundcolortogreenchangebackgroundcolortoredcouldbebad,indicatingapotentiallypoorseparationofconcerns可能是坏事,说明模块划分有问题changebackgroundcolortoredportsystemtoadifferentplatform,sun,49,2020/5/12,Step7:GenerateOverallEvaluation,Notallscenariosareequal.场景生来不平等Theorganizationmustdeterminewhichscenariosaremostimportant.必须明确哪些场景是最重要的Thentheorganizationmustdecideastowhetherthedesignisacceptable“asis”orifitmustbemodified.评审团得出结论,当前的体系结构设计可行,还是必须要修改,