资源描述
软件体系结构软件体系结构体系结构评审体系结构评审Architectural ReviewsArchitectural Reviews孙志岗 2 22021-12-19Architectural ReviewsnArchitectural reviews are a key step in architecture-based development. They include a method (such as SAAM or ATAM), but the full practice includes more than that.体系结构评审是开发过程中的一个重要环节。有专门的评体系结构评审是开发过程中的一个重要环节。有专门的评审方法审方法(SAAM、ATAM),但在实践中并不仅仅是这些,但在实践中并不仅仅是这些nWe will discusscost/benefits of architectural reviewsdifferent architectural review techniquespreconditions for an architectural reviewarchitectural review activitiesoutputs from an architectural review 3 32021-12-19Costs of Architectural ReviewsnThere are three different types of costs of holding regular architectural reviews.direct staff costs直接员工开销直接员工开销organizational overhead组织管理开销组织管理开销indirect staff costs间接员工开销间接员工开销 4 42021-12-19Examples of Direct Staff CostsnAT&T300 full-scale reviews done on projects of 700 staff-days or longer全面评审了全面评审了300个项目,每个项目的开发时间都是个项目,每个项目的开发时间都是700人日以上人日以上average cost per review: 70 staff days每次评审的平均开销:每次评审的平均开销:70人日人日nRational Software30 reviews done on projects with at least 500 KSLOC each评审了评审了30个项目,每个项目最少个项目,每个项目最少500 KSLOCaverage cost per review: $50,000评审平均花费:评审平均花费:$50,000 5 52021-12-19Examples of Direct Staff CostsnSAAM evaluations12 reviews done on projects ranging from 100 KSLOC to 1,000 KSLOC12次评审,项目规模从次评审,项目规模从100 KSLOC到到1,000 KSLOCaverage cost per review: 14 to 20 staff-days平均花费:平均花费:14到到20人日人日nATAM evaluations12 reviews done on projects ranging from 250 KSLOC to 2,500 KSLOC12次评审,项目规模从次评审,项目规模从250 KSLOC到到2,500 KSLOCaverage cost per review: 40 to 70 staff days平均花费:平均花费:40到到70人日人日 6 62021-12-19Example of Organizational OverheadnCosts of establishing a corporate review unit建立评审组的开销建立评审组的开销management overheadcommunication expensesstaffing the unit给评审组配备人手给评审组配备人手relocating personnel to a central locationtraining 7 72021-12-19Example of Indirect Staff CostsnUsing senior designers for evaluations instead of designing让高级设计人员参与评审而不是设计让高级设计人员参与评审而不是设计loss of productivity (due to reassignment of superior designers)生产力的下降生产力的下降(高级设计师被委派新任务高级设计师被委派新任务)time spent training staff in review techniques培训员工评审技术的时间消耗培训员工评审技术的时间消耗 8 82021-12-19Benefits of Architectural ReviewsnFive different types of benefits result from holding architectural reviews.financialforces preparation for review为评审做准备也是一种推动力为评审做准备也是一种推动力early detection of problems尽早地发现问题尽早地发现问题validation of requirements确认需求确认需求improved architectures提高体系结构质量提高体系结构质量 9 92021-12-19Financial Benefits of ReviewsnAT&T estimated that each reviewed project saves 10% of total cost as a result of the review. Thus, a 70-staff-day review of projects of 700 staff-days pays for itself.AT&T估算,每个被评审的项目节省估算,每个被评审的项目节省10%的成本的成本nConsultants who perform architecture evaluations report 80% repeat business.参与评审的顾问报告了参与评审的顾问报告了80%的重复项目的重复项目 10102021-12-19Forces Preparation for ReviewnDocumentation/specifications must be provided, hence they must exist or be created.文档和说明书必须存在文档和说明书必须存在nSome reviews use standard questions, and the architect can prepare ahead to ensure that the architecture scores well.评审有一些标准问题。体系结构师可以事先准备,确保这评审有一些标准问题。体系结构师可以事先准备,确保这个体系结构可能得高分个体系结构可能得高分nReviews make the criteria for evaluation explicit by prioritizing requirements or quality goals.通过排定需求和质量目标的顺序,评审使评估的标准变得通过排定需求和质量目标的顺序,评审使评估的标准变得清晰清晰 11112021-12-19Early Detection of ProblemsnThe problems that can be found by an architectural level inspection include在体系结构层进行检查可以发现的问题在体系结构层进行检查可以发现的问题unreasonable requirementsperformance problemsproblems associated with potential future modifications与未来的修改有关的问题与未来的修改有关的问题nThe earlier in the life cycle that problems are found, the easier it is to fix them. 12122021-12-19Validation of RequirementsnReviews put stakeholders in the same room with each other, often for the first time.评审使各种角色坐在同一个房间内。通常,这是第一次评审使各种角色坐在同一个房间内。通常,这是第一次uncovers conflicts and tradeoffs解开冲突和寻找折中解开冲突和寻找折中provides a forum for negotiated resolution of problems提供了一个论坛,来磋商问题的解决办法提供了一个论坛,来磋商问题的解决办法nIt often results in the generation of new requirements or the clarification of existing requirements.结果通常会是产生新的需求和净化已有的需求结果通常会是产生新的需求和净化已有的需求 13132021-12-19Improved ArchitecturesnDevelopment organizations anticipate types of questions raised at reviews and开发者预期在评审时会被发现的问题,然后开发者预期在评审时会被发现的问题,然后design architectures with questions in mind在设计时,问题会时刻围绕脑海在设计时,问题会时刻围绕脑海prepare documentation of the type needed at review准备评审时需要的文档准备评审时需要的文档give explicit consideration to qualities to be reviewed对将被评审的质量因素进行更深入的考虑对将被评审的质量因素进行更深入的考虑 14142021-12-19Review TechniquesnThere are a variety of techniques for performing architectural reviews; each has a different cost and provides different information.有很多种评审技术。每种需要不同的开销,提供不同的信有很多种评审技术。每种需要不同的开销,提供不同的信息息nThese techniques fall into one of two categories.questioning techniques: applied to evaluate any aspect of an architecture for any given reason提问技术提问技术:用来评价体系结构的任何方面:用来评价体系结构的任何方面measuring techniques: applied to answer questions about a specific quality度量技术度量技术:回答关于某项质量的问题:回答关于某项质量的问题 15152021-12-19Questioning TechniquesnScenario-based techniquesdescribes a specific interaction between stakeholders and a system描述角色与系统交互的过程描述角色与系统交互的过程example: SAAM, ATAM (partially)nQuestionnaire-based techniques(基于问卷的技术)(基于问卷的技术)Some questions apply to all architectures (especially those in a single domain).有些问题被用于所有的体系结构,尤其是在单一领域内有些问题被用于所有的体系结构,尤其是在单一领域内Some questions ask about details of a specific architecture.有些问题询问一个特定结构的细节有些问题询问一个特定结构的细节Some ask about the development process.n“Is there a single architect?”n“How do you ensure conformance?”“你们怎样保证一致性?你们怎样保证一致性?” 16162021-12-19Questioning TechniquesnQuestionnaires are reused; they reflect more maturity or experience within a domain.问卷可以重用;它们体现了在一个领域内问卷可以重用;它们体现了在一个领域内的成熟度和经验是否丰富的成熟度和经验是否丰富nScenarios must be developed anew for each system.场景必须为每个系统重新开发场景必须为每个系统重新开发 17172021-12-19Measuring TechniquesnMetrics: quantitative interpretations of observable measures量度:可测质量的定量说明量度:可测质量的定量说明complexity metrics identify areas where modifications may be difficult复杂度的测量指明在哪个区域修改会很困难复杂度的测量指明在哪个区域修改会很困难performance metrics suggest areas where bottlenecks may occur性能的测量提示瓶颈会在哪里发生性能的测量提示瓶颈会在哪里发生nReviews tend to focus onresults of metrics度量的结果度量的结果assumptions underlying the interpretation of the metrics (e.g., assumed event distribution)对度量的解释中的潜在假定对度量的解释中的潜在假定 18182021-12-19Measuring TechniquesnSimulations, prototypes, experiments: domain specific models of an architecture or performance model仿真、原型、实验:建立体系模型或者性能模型仿真、原型、实验:建立体系模型或者性能模型are expensive to createoften exist as part of development anywaynMay answer issues raised by questioning technique 可以回答提问技术提出的问题可以回答提问技术提出的问题“What evidence do you have that performance is adequate?”“你凭什么说可以达到这个性能?你凭什么说可以达到这个性能?” 19192021-12-19Properties of Review Techniques评审技术评审技术通用性通用性细节等级细节等级阶段阶段被评审对象被评审对象提问提问技术技术问卷问卷通用通用粗糙粗糙早期早期设计和过程设计和过程场景场景特定系统特定系统中等中等中期中期设计设计度量度量技术技术度量度量通用或者特通用或者特定领域定领域好好中期中期设计设计仿真仿真原型原型实验实验特定领域特定领域不定不定早期早期设计设计 20202021-12-19Review ProcessnAn architectural review has three major elements.preconditions: the set of necessary assets and conditions that must be in place before a review can be performed successfully前提前提:评审成功进行之前,必要的资源和条件必须到:评审成功进行之前,必要的资源和条件必须到位位activities of the review itself活动活动:评审本身:评审本身outputs: the report of review results输出输出:评审结果报告:评审结果报告 21212021-12-19Review PreconditionsnUnderstand the context of the review理解评审的上下文理解评审的上下文nAssemble the right people集合正确的人集合正确的人nSet organizational expectations and support期望和支持期望和支持nPrepare for review为评审做准备为评审做准备nObtain representation of the architecture获得体系结构文档获得体系结构文档 22222021-12-19Preconditions: ContextnPlanned reviewpart of normal development activity正常开发活动的一部分正常开发活动的一部分non-adversarial(非敌对性的)(非敌对性的)scheduled well in advance(事先安排好日程)(事先安排好日程)built into projects schedule and budget包含在项目日程和预算之内包含在项目日程和预算之内nUnplannedusually occurs when project is in trouble通常在项目出现问题时采用通常在项目出现问题时采用often devolves into finger-pointing导致互相责备导致互相责备can be painful for project already struggling对于已经苦苦挣扎了很久的项目而言,有些痛苦对于已经苦苦挣扎了很久的项目而言,有些痛苦 23232021-12-19Preconditions: ContextnTiming of the reviewearly “architecture discovery review”nis done after requirements are set, but before the architecture is firm需求分析之后,体系结构还没有确定之前进行需求分析之后,体系结构还没有确定之前进行nis used to understand implications of requirements on architecture用来理解需求在体系结构方面的隐含内容用来理解需求在体系结构方面的隐含内容nchecks for requirements feasibility(检查需求的可行性)(检查需求的可行性)nprioritizes architectural goals(为质量目标排序)(为质量目标排序)full architectural reviewnis done when architectural documentation is available体系结构文档可用时进行体系结构文档可用时进行nis used to evaluate qualities of proposed architecture评价被评体系结构的质量评价被评体系结构的质量 24242021-12-19Preconditions: PeoplenRepresentatives of project(项目代表)(项目代表)architectdesigners of major modulesstakeholders representativesnReview team members (ideally, a separate unit)评审团成员评审团成员(理想情况下是一个独立组织理想情况下是一个独立组织)at least one domain expert included至少有一个领域专家至少有一个领域专家someone to handle logistics (e.g., meeting rooms, supplies)后勤人员后勤人员(会议室、茶水、食品会议室、茶水、食品)librarian to organize documentation文档管理员文档管理员“apprentice reviewer” for growth成长中的评审员学徒成长中的评审员学徒 25252021-12-19Preconditions: Review TeamnThe review team must be assembled so thatmembers are perceived as impartial, objective, and respected成员要公正、客观和被尊重成员要公正、客观和被尊重members devote their full-time effort to the review成员全心加入评审成员全心加入评审members are fluent in architecture and architectural issues成员要训练有素而且口才好成员要训练有素而且口才好it is located close to artifacts being examined有足够的权限检查被评审材料有足够的权限检查被评审材料 26262021-12-19Preconditions: Review TeamnThe team must have access toapplicable domain knowledge (perhaps via consultants to the team)适当的领域知识适当的领域知识design documents设计文档设计文档review criteria评审标准评审标准support staff支持人员支持人员 27272021-12-19Preconditions: OrganizationalExpectationsnA contract between the review team and the sponsor of the review must be established.Who will be told what upon completion?结束后,哪些内容可以被告诉哪些人结束后,哪些内容可以被告诉哪些人What will (not) be the review criteria?什么是什么是(不是不是)评审标准?评审标准?What/who will be made available to team?哪些人和物是评审团可以使用的?哪些人和物是评审团可以使用的?What follow-up is expected?希望评审的结果如何?希望评审的结果如何?How long will the review take?要评审多久?要评审多久? 28282021-12-19Preconditions: OrganizationalExpectationsnOrganizational culture and support must be considered.Are reviews part of the standard project life cycle?评审是项目的基本生命周期的一部分吗?评审是项目的基本生命周期的一部分吗?Is serving on a review team considered good for ones career?为评审团服务是份好差事吗?为评审团服务是份好差事吗?Will the organization allow its superior designers time off from their projects to serve on review teams?企业允许它的高级设计师把他的项目放在一边来参加评审吗?企业允许它的高级设计师把他的项目放在一边来参加评审吗?Is there a standing review organization (even though members may rotate on and off)?有常设的评审组织吗有常设的评审组织吗(即便成员常进进出出即便成员常进进出出)? 29292021-12-19Preconditions: Read-Ahead MaterialnFor project being reviewedquestionnairesscenarios (These are created as part of the review, but time should be allowed for project members to digest the information.)nFor review teamdescription of architecturerationale for architecturenIdeally, material will address the review questions. (Passing this test because the questions were known in advance is not cheating, but good engineering!)理想情况,材料要能说明评审时的问题理想情况,材料要能说明评审时的问题 30302021-12-19Preconditions: Ranked Qualityand Behavioral RequirementsnPlan to examine three to five quality and behavioral requirements.计划检查计划检查3到到5个质量和行为需求个质量和行为需求nA particular representation medium (language) for the architecture is not necessary. As long as the information can be extracted (using project members as necessary), the form of the representation is not important.一个专门的体系结构表述媒体一个专门的体系结构表述媒体(语言语言)目前并不是目前并不是必须的。由项目成员来讲解信息,表述的形式并必须的。由项目成员来讲解信息,表述的形式并不重要不重要 31312021-12-19Review ActivitiesnEvaluate“Run” the scenarios and ask the questions, or answer the items in the checklist.按场景执行,并询问相关问题;或者回答问卷里的问按场景执行,并询问相关问题;或者回答问卷里的问题题Perform the experiments.(演示实验)(演示实验)Execute the prototypes or simulations.运行原型或仿真程序运行原型或仿真程序nRecordcritical issues highlighted in the review评审中发现的严重问题评审中发现的严重问题comments of project members on these issues项目成员对这些问题的说明项目成员对这些问题的说明 32322021-12-19Review ActivitiesnRank the issuesproject-threatening(生死攸关)(生死攸关)majorminornEach issue raised should be addressed in terms ofchanging the architecturerelaxing the requirements 33332021-12-19Review ActivitiesnWarning signsarchitecture forced to match organization组织模式影响体系结构组织模式影响体系结构top-level components number over 25顶层组件数超过顶层组件数超过25个个one requirement drives entire design一项需求决定整个设计一项需求决定整个设计architecture depends on alternatives in the operating system体系受操作系统选择的影响体系受操作系统选择的影响 34342021-12-19Review ActivitiesnWarning signschoice of software components is dictated by hardware personnel由硬件人员选择软件组件由硬件人员选择软件组件redundancy not needed for reliability面对可靠性时,不考虑冗余手段面对可靠性时,不考虑冗余手段design is exception driven零散的小的事件影响设计零散的小的事件影响设计no identifiable architect没有确定的架构师没有确定的架构师 35352021-12-19Output from ReviewnSet of ranked issuessupporting datacontained in formal reportfeedback to projectnEnhanced system documentation增强的系统文档增强的系统文档nSet of scenarios for future use将来会用到的场景集将来会用到的场景集nIdentification of potentially reusable components认定潜在的可重用组件认定潜在的可重用组件nEstimation of costs and benefits估算成本和收益估算成本和收益 36362021-12-19SAAM: Software Architecture Analysis Method 一种简单的基于场景的评审技术一种简单的基于场景的评审技术 37372021-12-19Qualities Are Too Vague for AnalysisnIs the following system modifiable?这个系统具有适应性吗?这个系统具有适应性吗?Background color of the user interface is changed merely by modifying a resource file.通过修改资源文件,可以改变界面的背景色通过修改资源文件,可以改变界面的背景色Dozens of components must be changed to accommodate a new data file format.必须修改许多组件才能适应新的文件格式必须修改许多组件才能适应新的文件格式nA reasonable answer is一个合理的答案:一个合理的答案:yes with respect to changing background color有有,从改变背景色的角度来看,从改变背景色的角度来看no with respect to changing file format没有没有,从改变文件格式的角度来看,从改变文件格式的角度来看 38382021-12-19Qualities Are Too Vague for AnalysisnQualities only have meaning within a context.质量因素只在一定的上下文里才有意义质量因素只在一定的上下文里才有意义nSAAM specifies context through scenarios.SAAM通过场景指定上下文通过场景指定上下文 39392021-12-19ScenariosnA scenario is a brief description of a stakeholders interaction with a system.场景就是一个角色与系统交互过程的简单描述场景就是一个角色与系统交互过程的简单描述nWhen creating scenarios, it is important to consider all stakeholders.建立场景的时候,一定要考虑到所有的角色建立场景的时候,一定要考虑到所有的角色Customer、User、Developer、Maintainer、AttackernThe scenarios that are of most interest in a SAAM evaluation are change scenarios.SAAM最关心的是最关心的是变化变化场景场景 40402021-12-19Steps of a SAAM EvaluationnIdentify and assemble stakeholders确认和召集角色确认和召集角色nDevelop and prioritize scenarios制定场景,并排好优先级制定场景,并排好优先级nDescribe candidate architecture(s)描述候选的体系结构描述候选的体系结构nClassify scenarios as direct or indirect把场景分类为把场景分类为直接场景直接场景和和间接场景间接场景nPerform scenario evaluation进行场景评估进行场景评估nReveal scenario interactions展现场景间的相互影响展现场景间的相互影响nGenerate overall evaluation整体评估整体评估 41412021-12-19Step 1: Identify and Assemble StakeholdersStakeholderInterestCustomerSchedule and budget; usefulness of system; meeting customers (or markets) expectationsEnd UserFunctionality, usabilityDeveloperClarity and completeness ofarchitecture; high cohesion andlimited coupling of parts;clear interaction mechanismsMaintainerMaintainability; ability to locateplaces of change 42422021-12-19Step 1: Identify and Assemble StakeholdersStakeholderInterestSystem AdministratorEase in finding sources of operational problemsNetwork AdministratorNetwork performance, predictabilityIntergratorClarity and completeness ofarchitecture; high cohesion andlimited coupling of parts;clear interaction mechanisms 43432021-12-19Step 1: Identify and AssembleStakeholdersStakeholderInterestTesterIntegrated, consistent error handling; limited component coupling; high component cohesion; conceptual integrityApplication BuilderArchitectural clarity, completeness; interaction mechanisms; simple tailoring mechanismsRepresentative of the domainInteroperability 44442021-12-19Step 2: Stakeholders Develop andPrioritize ScenariosnScenarios should be typical of the kinds of evolution that the system must support:场景应该是系统必须支持的各种演化的典型:场景应该是系统必须支持的各种演化的典型:functionalitydevelopment activitieschange activitiesnScenarios should represent tasks relevant to all stakeholders.所有角色都应该能在场景中体现出来所有角色都应该能在场景中体现出来nRule of thumb: 10-15 prioritized scenarios应该有应该有10-15个优先的场景个优先的场景 45452021-12-19Step 3: Describe CandidateArchitecturesnIt is frequently necessary to elicit appropriate architectural descriptions.通常,对体系结构进行适当的描述是非常通常,对体系结构进行适当的描述是非常重要的重要的nStructures chosen to describe the architecture will depend on the type of qualities to be evaluated.以我们需要的质量为依据,选择用来描述以我们需要的质量为依据,选择用来描述体系结构的结构体系结构的结构 46462021-12-19Step 4: Classify ScenariosnThere are two classes of scenarios.Direct scenarios are those that can be executed by the system without modification.直接场景是那些不需要修改系统就能执行的场景直接场景是那些不需要修改系统就能执行的场景Indirect scenarios are those that require modifications to the system.间接场景是那些需要修改系统的场景间接场景是那些需要修改系统的场景nThe classification depends upon both the scenario and the architecture.场景的类型因系统而异场景的类型因系统而异nFor indirect scenarios we gauge the order of difficulty of each change: e.g. a person-day, person-week, person-month, person-year.对间接场景,我们要度量适应每个变化的难度(工作量)对间接场景,我们要度量适应每个变化的难度(工作量) 47472021-12-19Step 5: Perform Scenario EvaluationnFor each indirect scenarioidentify the components, data connections, control connections, and interfaces that must be added, deleted, or modified明确其组件、数据连结件、控制连结件和要被增加、删除或修改明确其组件、数据连结件、控制连结件和要被增加、删除或修改的接口的接口estimate the difficulty of modification估算修改的难度估算修改的难度nDifficulty of modification is elicited from the architect and is based on the number of components to be modified and the effect of the modifications.修改的难度体现在被修改的组件个数和修改的效果修改的难度体现在被修改的组件个数和修改的效果nA monolithic system will score well on this step, but not on next step.只有一个模块的系统在此项评估可以得到高分,但是只有一个模块的系统在此项评估可以得到高分,但是 48482021-12-19Step 6: Reveal Scenario InteractionsnWhen multiple indirect scenarios affect the same components, this could indicate a problem.当多个间接场景影响同一个组件时,可能引发问题当多个间接场景影响同一个组件时,可能引发问题could be good, if scenarios are variants of each other可能是好事,当场景是彼此的变体可能是好事,当场景是彼此的变体nchange background color to greennchange background color to redcould be bad, indicating a potentially poor separation of concerns可能是坏事,说明模块划分有问题可能是坏事,说明模块划分有问题nchange background color to rednport system to a different platform 49492021-12-19Step 7: Generate Overall EvaluationnNot all scenarios are equal.场景生来不平等场景生来不平等nThe organization must determine which scenarios are most important.必须明确哪些场景是最重要的必须明确哪些场景是最重要的nThen the organization must decide as to whether the design is acceptable “as is” or if it must be modified.评审团得出结论,当前的体系结构设计可行,还评审团得出结论,当前的体系结构设计可行,还是必须要修改是必须要修改
展开阅读全文