1、软件体系结构评审,张平健 华南理工大学软件学院,2,Architectural Reviews,Architectural 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),但在实践中并不仅仅是这些 We will discuss why and when cost/
2、benefits of architectural reviews different architectural review techniques preconditions for an architectural review architectural review activities outputs from an architectural review,3,Costs of Architectural Reviews,There are three different types of costs of holding regular architectural review
3、s. direct staff costs 直接员工开销 organizational overhead 组织管理开销 indirect staff costs 间接员工开销,4,Examples of Direct Staff Costs,AT&T 300 full-scale reviews done on projects of 700 staff-days or longer 全面评审了300个项目,每个项目的开发时间都是700人日以上 average cost per review: 70 staff days 每次评审的平均开销:70人日 Rational Software 30
4、reviews done on projects with at least 500 KSLOC each 评审了30个项目,每个项目最少500 KSLOC average cost per review: $50,000 评审平均花费:$50,000,5,Examples of Direct Staff Costs,SAAM evaluations 12 reviews done on projects ranging from 100 KSLOC to 1,000 KSLOC 12次评审,项目规模从100 KSLOC到1,000 KSLOC average cost per review:
5、 14 to 20 staff-days 平均花费:14到20人日 ATAM evaluations 12 reviews done on projects ranging from 250 KSLOC to 2,500 KSLOC 12次评审,项目规模从250 KSLOC到2,500 KSLOC average cost per review: 40 to 70 staff days 平均花费:40到70人日,6,Example of Organizational Overhead,Costs of establishing a corporate review unit 建立评审组的开销
6、management overhead communication expenses staffing the unit 给评审组配备人手 relocating personnel to a central location training,7,Example of Indirect Staff Costs,Using senior designers for evaluations instead of designing 让高级设计人员参与评审而不是设计 loss of productivity (due to reassignment of superior designers) 生产
7、力的下降(高级设计师被委派新任务) time spent training staff in review techniques 培训员工评审技术的时间消耗,8,Benefits of Architectural Reviews,Five different types of benefits result from holding architectural reviews. financial forces preparation for review 推动为评审做准备 captured rationale early detection of problems 尽早地发现问题 valid
8、ation of requirements 确认需求 improved architectures 提高体系结构质量,9,Financial Benefits of Reviews,AT&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%的成本 Consultants who p
9、erform architecture evaluations report 80% repeat business. 参与评审的顾问报告了80%的重复项目,10,Forces Preparation for Review,Documentation/specifications must be provided, hence they must exist or be created. 文档和说明书必须存在 Some reviews use standard questions, and the architect can prepare ahead to ensure that the a
10、rchitecture scores well. 评审有一些标准问题。体系结构师可以事先准备,确保这个体系结构可能得高分 Reviews make the criteria for evaluation explicit by prioritizing requirements or quality goals. 通过排定需求和质量目标的顺序,评审使评估的标准变得清晰,11,Early Detection of Problems,The problems that can be found by an architectural level inspection include 在体系结构层进
11、行检查可以发现的问题 unreasonable requirements performance problems problems associated with potential future modifications 与未来的修改有关的问题 The earlier in the life cycle that problems are found, the easier it is to fix them.,12,Validation of Requirements,Reviews put stakeholders in the same room with each other,
12、often for the first time. 评审使各种角色坐在同一个房间内。通常,这是第一次 uncovers conflicts and tradeoffs 解开冲突和寻找折中 provides a forum for negotiated resolution of problems 提供了一个论坛,来磋商问题的解决办法 It often results in the generation of new requirements or the clarification of existing requirements. 结果通常会是产生新的需求和净化已有的需求,13,Improv
13、ed Architectures,Development 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 对将被评审的质量
14、因素进行更深入的考虑,14,Review Techniques,There are a variety of techniques for performing architectural reviews; each has a different cost and provides different information. 有很多种评审技术。每种需要不同的开销,提供不同的信息 These techniques fall into one of two categories. questioning techniques: applied to evaluate any aspect of
15、 an architecture for any given reason 提问技术:用来评价体系结构的任何方面 measuring techniques: applied to answer questions about a specific quality 度量技术:回答关于某项质量的问题,15,Questioning Techniques,Scenario-based techniques describes a specific interaction between stakeholders and a system 描述角色与系统交互的过程 example: SAAM, ATAM
16、 (partially) Questionnaire-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. “Is there a single archi
17、tect?” “How do you ensure conformance?” “你们怎样保证一致性?”,16,Questioning Techniques,Questionnaires are reused; they reflect more maturity or experience within a domain. 问卷可以重用;它们体现了在一个领域内的成熟度和经验是否丰富 Scenarios must be developed anew for each system. 场景必须为每个系统重新开发,17,Measuring Techniques,Metrics: quantitat
18、ive interpretations of observable measures 度量:可测量的定量说明 complexity metrics identify areas where modifications may be difficult 复杂度的度量指明在哪个区域修改会很困难 performance metrics suggest areas where bottlenecks may occur 性能的度量提示瓶颈会在哪里发生 Reviews tend to focus on results of metrics 度量的结果 assumptions underlying the
19、 interpretation of the metrics (e.g., assumed event distribution) 对度量的解释中的潜在假定,18,Measuring Techniques,Simulations, prototypes, experiments: domain specific models of an architecture or performance model 仿真、原型、实验:建立体系模型或者性能模型 are expensive to create often exist as part of development anyway May answ
20、er issues raised by questioning technique 可以回答提问技术提出的问题 “What evidence do you have that performance is adequate?” “你凭什么说可以达到这个性能?”,19,Properties of Review Techniques,20,Review Process,An architectural review has three major elements. preconditions: the set of necessary assets and conditions that mus
21、t be in place before a review can be performed successfully 前提:评审成功进行之前,必要的资源和条件必须到位 activities of the review itself 活动:评审本身 outputs: the report of review results 输出:评审结果报告,21,Review Preconditions,Understand the context of the review 理解评审的背景 Assemble the right people 集合正确的人 Set organizational expect
22、ations and support 期望和支持 Prepare for review 为评审做准备 Obtain representation of the architecture 获得体系结构文档,22,Preconditions: Context,Planned review part of normal development activity 正常开发活动的一部分 non-adversarial(非敌对性的) scheduled well in advance(事先安排好日程) built into projects schedule and budget 包含在项目日程和预算之内
23、 Unplanned usually occurs when project is in trouble 通常在项目出现问题时采用 often devolves into finger-pointing 导致互相责备 can be painful for project already struggling 对于已经苦苦挣扎了很久的项目而言,有些痛苦,23,Preconditions: Context,Timing of the review early “architecture discovery review” is done after requirements are set, bu
24、t before the architecture is firm 需求分析之后,体系结构还没有确定之前进行 is used to understand implications of requirements on architecture 用来理解需求在体系结构方面的隐含内容 checks for requirements feasibility(检查需求的可行性) prioritizes architectural goals(为质量目标排序) full architectural review is done when architectural documentation is av
25、ailable 体系结构文档可用时进行 is used to evaluate qualities of proposed architecture 评价被评体系结构的质量,24,Preconditions: People,Representatives of project(项目代表) architect designers of major modules stakeholders representatives Review team members (ideally, a separate unit) 评审团成员(理想情况下是一个独立组织) at least one domain ex
26、pert included 至少有一个领域专家 someone to handle logistics (e.g., meeting rooms, supplies) 后勤人员(会议室、茶水、食品) librarian to organize documentation 文档管理员 “apprentice reviewer” for growth 成长中的评审员学徒,25,Preconditions: Review Team,The review team must be assembled so that members are perceived as impartial, objecti
27、ve, 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 有足够的权限检查被评审材料,26,Preconditions: Review Team,The team must have access to applicable doma
28、in knowledge (perhaps via consultants to the team) 适当的领域知识 design documents 设计文档 review criteria 评审标准 support staff 支持人员,27,Preconditions: Organizational Expectations,A contract between the review team and the sponsor of the review must be established. Who will be told what upon completion? 结束后,哪些内容
29、可以被告诉哪些人 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? 要评审多久?,28,Preconditions: Organizational Expectations,Organizational culture and support must be considered. Are
30、 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 re
31、view organization (even though members may rotate on and off)? 有常设的评审组织吗(即便成员常进进出出)?,29,Preconditions: Read-Ahead Material,For project being reviewed questionnaires scenarios (These are created as part of the review, but time should be allowed for project members to digest the information.) For revi
32、ew team description of architecture rationale for architecture Ideally, material will address the review questions. (Passing this test because the questions were known in advance is not cheating, but good engineering!) 理想情况,材料要能说明评审时的问题,30,Preconditions: Ranked Quality and Behavioral Requirements,Pl
33、an to examine three to five quality and behavioral requirements. 计划检查3到5个质量和行为需求 A 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. 一个专
34、门的体系结构表述媒体(语言)目前并不是必须的。由项目成员来讲解信息,表述的形式并不重要,31,Review Activities,Evaluate “Run” the scenarios and ask the questions, or answer the items in the checklist. 按场景执行,并询问相关问题;或者回答问卷里的问题 Perform the experiments.(演示实验) Execute the prototypes or simulations. 运行原型或仿真程序 Record critical issues highlighted in th
35、e review 评审中发现的严重问题 comments of project members on these issues 项目成员对这些问题的说明,32,Review Activities,Rank the issues project-threatening(生死攸关) major minor Each issue raised should be addressed in terms of changing the architecture relaxing the requirements,33,Review Activities,Warning signs architectur
36、e forced to match organization 组织模式影响体系结构 top-level components number over 25 顶层组件数超过25个 one requirement drives entire design 一项需求决定整个设计 architecture depends on alternatives in the operating system 体系受操作系统选择的影响,34,Review Activities,Warning signs choice of software components is dictated by hardware
37、personnel 由硬件人员选择软件组件 redundancy not needed for reliability 面对可靠性时,不考虑冗余手段 design is exception driven 零散的小的事件影响设计 no identifiable architect 没有确定的架构师,35,Output from Review,Set of ranked issues supporting data contained in formal report feedback to project Enhanced system documentation 增强的系统文档 Set of
38、scenarios for future use 将来会用到的场景集 Identification of potentially reusable components 认定潜在的可重用组件 Estimation of costs and benefits 估算成本和收益,36,Architecture Tradeoff Analysis Methodsm (ATAMsm),SMATAM and Architecture Tradeoff Analysis Method are registered service marks of Carnegie Mellon University,37,
39、Why Analyze Software Architectures?,All design involves tradeoff in system qualities(设计即折中) System qualities are largely dependent on architectural decisions 体系结构极大地影响系统质量 Promoting one quality often comes at the expense of another quality 提高一个质量,经常会降低另一个质量 A software architecture is the earliest li
40、fe-cycle artifact that embodies significant design decisions: choices and tradeoffs. “选择与折中”是设计中首要考虑的问题,软件体系结构是软件生命周期中最早一个遇到此问题的 Choices are easy to make, but hard to change once the system is implemented 选择很容易做,但是一旦系统已经实现,就很难更改,38,The ATAM,The purpose of the ATAM: is to assess the consequences of a
41、rchitectural decisions in light of quality attribute requirements. ATAM的目标是:按照质量需求,评价体系结构设计,39,Context for the ATAM,Business Goals,Architecture Decisions,P,A,S,M,$ Value $,$ Cost $,40,Purpose of ATAM,We need a method in which the right questions are asked early to 我们需要一个新方法,让我们能尽早提出正确问题,来: Discover
42、risks - alternatives that might create future problems in some quality attribute 发现风险:可能在将来产生质量问题的方案 Discover non-risks - decisions that promote qualities that help realize business/mission goals 发现非风险:可以提高质量的决策 Discover sensitivity points - alternatives for which a slight change makes a significant
43、 difference in some quality attribute 发现敏感点:方案中一个小小的变化,就可能让质量完全大变样 Discover tradeoffs - decisions affecting more than one quality attribute 发现折中:影响一个以上质量的决策,41,Purpose of ATAM,The purpose of an ATAM is NOT to provide precise analyses, but to discover risks created by architectural decisions. ATAM的目标
44、不是做精确的分析,而是发现体系结构可能带来的风险 We want to find trends: correlation between architectural decisions and predictions of system properties. 我们要发现一些趋势:从体系结构方案预言系统的特性 Discovered risks can then be made the focus of mitigation activities: e.g. further design, further analysis, prototyping. 发现风险,然后做进一步的分析、设计 Surf
45、aced tradeoffs can be explicitly identified and documented. 明显的折中可以被清晰地指出并写入文档,42,ATAM Benefits,There are a number of benefits from performing ATAM analyses: 做ATAM分析可以得到下列益处: Clarified quality attribute requirements 明确质量需求 Improved architecture documentation 提高体系结构文档质量 Documented basis for architect
46、ural decisions 文档化了的体系结构方案基础 Identified risks early in the life-cycle 及早发现风险 Increased communication among stakeholders 促进了角色之间的交流 The results are improved architectures. 结果是,体系结构得到改进,43,Preconditions for an ATAM,Clients must have a Software Architecture Scope/scale must be manageable 其作用范围和程度必须可管理
47、ATAM will not work if the software architecture has not been created yet 如果体系结构还没有被建立,那么ATAM毫无用武之地 ATAM team members will review architectural artifacts, and may help refine documentation ATAM组将评估体系结构,并帮助改善文档 Architect must prepare an architecture presentation 架构师必须准备一个体系结构讲解 Clients must prepare a
48、business/mission goals presentation 必须有一个商业/任务目标讲解 ATAM will review architecture artifacts, presentations, and read ahead material to become familiar with domain ATAM要事先阅读一些材料来熟悉这个领域,44,Evaluation Team,Each ATAM team consists of a leader and at least three other team members 每个ATAM组有一个组长和至少三个组员 doma
49、in expertise is not necessary 领域专家不是必须 ATAM team members must be experienced architects ATAM组员必须是经验丰富的架构师 ATAM leaders must have EXCELLENT communication and facilitation skills ATAM组长必须有优秀的交流和激励技巧 The ATAM team members fill multiple roles during the course of the evaluation. ATAM组员在评审过程中扮演多种角色,45,Ev
50、aluation Team Roles,Moderator facilitates discussions, brainstorming, analysis 主持人:推动讲解、自由讨论和分析 Scenario scribe(s) writes utility tree, raw scenarios, risks, sensitivities, tradeoffs on flipcharts or whiteboards 场景记录员:在白板上记下原始场景、有效树、风险、关键点和折中 Proceedings scribe captures scribes writing on a laptop computer, preparing the Results, Presentation template 会议记录员:把场景记录员写下的内容录入电脑,准备结论讲解模板,