Architectural Reviews sunhit edu cn sunhit edu cn

  • Slides: 49
Download presentation
软件体系结构评审 Architectural Reviews 孙志岗 sun@hit. edu. cn © sun@hit. edu. cn

软件体系结构评审 Architectural Reviews 孙志岗 sun@hit. edu. cn © sun@hit. edu. cn

Architectural Reviews n n Architectural reviews are a key step in architecturebased development. They

Architectural Reviews n n Architectural reviews are a key step in architecturebased development. They include a method (such as SAAM or ATAM), but the full practice includes more than that. 体系结构评审是开发过程中的一个重要环节。有专门的评 审方法(SAAM、ATAM),但在实践中并不仅仅是这些 We will discuss ¨ ¨ ¨ 2/22/2021 cost/benefits of architectural reviews different architectural review techniques preconditions for an architectural review activities outputs from an architectural review © sun@hit. edu. cn 2

Costs of Architectural Reviews n There are three different types of costs of holding

Costs of Architectural Reviews n There are three different types of costs of holding regular architectural reviews. ¨ direct staff costs 直接员 开销 ¨ organizational overhead 组织管理开销 ¨ indirect staff costs 间接员 开销 2/22/2021 © sun@hit. edu. cn 3

Examples of Direct Staff Costs n AT&T ¨ 300 full-scale reviews done on projects

Examples of Direct Staff Costs n 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人日 n Rational Software ¨ 30 reviews done on projects with at least 500 KSLOC each 评审了30个项目,每个项目最少 500 KSLOC ¨ average cost per review: $50, 000 评审平均花费:$50, 000 2/22/2021 © sun@hit. edu. cn 4

Examples of Direct Staff Costs n SAAM evaluations ¨ 12 reviews done on projects

Examples of Direct Staff Costs n 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: 14 to 20 staff-days 平均花费: 14到 20人日 n 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人日 2/22/2021 © sun@hit. edu. cn 5

Example of Organizational Overhead n Costs of establishing a corporate review unit 建立评审组的开销 ¨

Example of Organizational Overhead n Costs of establishing a corporate review unit 建立评审组的开销 ¨ management overhead ¨ communication expenses ¨ staffing the unit 给评审组配备人手 ¨ relocating personnel to a central location ¨ training 2/22/2021 © sun@hit. edu. cn 6

Example of Indirect Staff Costs n Using senior designers for evaluations instead of designing

Example of Indirect Staff Costs n Using senior designers for evaluations instead of designing 让高级设计人员参与评审而不是设计 ¨ loss of productivity (due to reassignment of superior designers) 生产力的下降(高级设计师被委派新任务) ¨ time spent training staff in review techniques 培训员 评审技术的时间消耗 2/22/2021 © sun@hit. edu. cn 7

Benefits of Architectural Reviews n Five different types of benefits result from holding architectural

Benefits of Architectural Reviews n Five different types of benefits result from holding architectural reviews. ¨ financial ¨ forces preparation for review 为评审做准备也是一种推动力 ¨ early detection of problems 尽早地发现问题 ¨ validation of requirements 确认需求 ¨ improved architectures 提高体系结构质量 2/22/2021 © sun@hit. edu. cn 8

Financial Benefits of Reviews n n AT&T estimated that each reviewed project saves 10%

Financial Benefits of Reviews n n 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 perform architecture evaluations report 80% repeat business. 参与评审的顾问报告了80%的重复项目 2/22/2021 © sun@hit. edu. cn 9

Forces Preparation for Review n n n Documentation/specifications must be provided, hence they must

Forces Preparation for Review n n n 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 architecture scores well. 评审有一些标准问题。体系结构师可以事先准备,确保这 个体系结构可能得高分 Reviews make the criteria for evaluation explicit by prioritizing requirements or quality goals. 通过排定需求和质量目标的顺序,评审使评估的标准变得 清晰 2/22/2021 © sun@hit. edu. cn 10

Early Detection of Problems n The problems that can be found by an architectural

Early Detection of Problems n The problems that can be found by an architectural level inspection include 在体系结构层进行检查可以发现的问题 ¨ unreasonable requirements ¨ performance problems ¨ problems associated with potential future modifications 与未来的修改有关的问题 n The earlier in the life cycle that problems are found, the easier it is to fix them. 2/22/2021 © sun@hit. edu. cn 11

Validation of Requirements n Reviews put stakeholders in the same room with each other,

Validation of Requirements n Reviews 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 提供了一个论坛,来磋商问题的解决办法 ¨ n It often results in the generation of new requirements or the clarification of existing requirements. 结果通常会是产生新的需求和净化已有的需求 2/22/2021 © sun@hit. edu. cn 12

Improved Architectures n Development organizations anticipate types of questions raised at reviews and 开发者预期在评审时会被发现的问题,然后

Improved Architectures n 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 对将被评审的质量因素进行更深入的考虑 2/22/2021 © sun@hit. edu. cn 13

Review Techniques n n There a variety of techniques for performing architectural reviews; each

Review Techniques n n There 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 an architecture for any given reason 提问技术:用来评价体系结构的任何方面 ¨ measuring techniques: applied to answer questions about a specific quality 度量技术:回答关于某项质量的问题 ¨ 2/22/2021 © sun@hit. edu. cn 14

Questioning Techniques n Scenario-based techniques describes a specific interaction between stakeholders and a system

Questioning Techniques n Scenario-based techniques describes a specific interaction between stakeholders and a system 描述角色与系统交互的过程 ¨ example: SAAM, ATAM (partially) ¨ n 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. ¨ n n 2/22/2021 “Is there a single architect? ” “How do you ensure conformance? ” “你们怎样保证一致性?” © sun@hit. edu. cn 15

Questioning Techniques Questionnaires are reused; they reflect more maturity or experience within a domain.

Questioning Techniques Questionnaires are reused; they reflect more maturity or experience within a domain. 问卷可以重用;它们体现了在一个领域内 的成熟度和经验是否丰富 n Scenarios must be developed anew for each system. 场景必须为每个系统重新开发 n 2/22/2021 © sun@hit. edu. cn 16

Measuring Techniques n Metrics: quantitative interpretations of observable measures 量度:可测质量的定量说明 complexity metrics identify areas

Measuring Techniques n Metrics: quantitative interpretations of observable measures 量度:可测质量的定量说明 complexity metrics identify areas where modifications may be difficult 复杂度的测量指明在哪个区域修改会很困难 ¨ performance metrics suggest areas where bottlenecks may occur 性能的测量提示瓶颈会在哪里发生 ¨ n Reviews tend to focus on results of metrics 度量的结果 ¨ assumptions underlying the interpretation of the metrics (e. g. , assumed event distribution) 对度量的解释中的潜在假定 ¨ 2/22/2021 © sun@hit. edu. cn 17

Measuring Techniques n Simulations, prototypes, experiments: domain specific models of an architecture or performance

Measuring Techniques n Simulations, prototypes, experiments: domain specific models of an architecture or performance model 仿真、原型、实验:建立体系模型或者性能模型 ¨ are expensive to create ¨ often exist as part of development n anyway May answer issues raised by questioning technique 可以回答提问技术提出的问题 ¨ “What evidence do you have that performance is adequate? ” “你凭什么说可以达到这个性能?” 2/22/2021 © sun@hit. edu. cn 18

Review Process n An architectural review has three major elements. ¨ preconditions: the set

Review Process n An 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 输出:评审结果报告 2/22/2021 © sun@hit. edu. cn 20

Review Preconditions n n n Understand the context of the review 理解评审的上下文 Assemble the

Review Preconditions n n n Understand the context of the review 理解评审的上下文 Assemble the right people 集合正确的人 Set organizational expectations and support 期望和支持 Prepare for review 为评审做准备 Obtain representation of the architecture 获得体系结构文档 2/22/2021 © sun@hit. edu. cn 21

Preconditions: Context n Planned review part of normal development activity 正常开发活动的一部分 ¨ non-adversarial(非敌对性的) ¨

Preconditions: Context n Planned review part of normal development activity 正常开发活动的一部分 ¨ non-adversarial(非敌对性的) ¨ scheduled well in advance(事先安排好日程) ¨ built into project’s schedule and budget 包含在项目日程和预算之内 ¨ n Unplanned usually occurs when project is in trouble 通常在项目出现问题时采用 ¨ often devolves into finger-pointing 导致互相责备 ¨ can be painful for project already struggling 对于已经苦苦挣扎了很久的项目而言,有些痛苦 ¨ 2/22/2021 © sun@hit. edu. cn 22

Preconditions: Context n Timing of the review ¨ early “architecture discovery review” n is

Preconditions: Context n Timing of the review ¨ early “architecture discovery review” n is done after requirements are set, but before the architecture is firm 需求分析之后,体系结构还没有确定之前进行 n is used to understand implications of requirements on architecture 用来理解需求在体系结构方面的隐含内容 n checks for requirements feasibility(检查需求的可行性) n prioritizes architectural goals(为质量目标排序) ¨ full architectural review n is done when architectural documentation is available 体系结构文档可用时进行 n is used to evaluate qualities of proposed architecture 评价被评体系结构的质量 2/22/2021 © sun@hit. edu. cn 23

Preconditions: People n Representatives of project(项目代表) ¨ ¨ ¨ n architect designers of major

Preconditions: People n Representatives of project(项目代表) ¨ ¨ ¨ n architect designers of major modules stakeholders’ representatives Review 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 成长中的评审员学徒 ¨ 2/22/2021 © sun@hit. edu. cn 24

Preconditions: Review Team n The review team must be assembled so that ¨ members

Preconditions: Review Team n The review team must be assembled so that ¨ members 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 有足够的权限检查被评审材料 2/22/2021 © sun@hit. edu. cn 25

Preconditions: Review Team n The team must have access to ¨ applicable domain knowledge

Preconditions: Review Team n The team must have access to ¨ applicable domain knowledge (perhaps via consultants to the team) 适当的领域知识 ¨ design documents 设计文档 ¨ review criteria 评审标准 ¨ support staff 支持人员 2/22/2021 © sun@hit. edu. cn 26

Preconditions: Organizational Expectations n A contract between the review team and the sponsor of

Preconditions: Organizational Expectations n A 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? 要评审多久? 2/22/2021 © sun@hit. edu. cn 27

Preconditions: Organizational Expectations n Organizational culture and support must be considered. Are reviews part

Preconditions: Organizational Expectations n Organizational culture and support must be considered. Are reviews part of the standard project life cycle? 评审是项目的基本生命周期的一部分吗? ¨ Is serving on a review team considered good for one’s 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)? 有常设的评审组织吗(即便成员常进进出出)? ¨ 2/22/2021 © sun@hit. edu. cn 28

Preconditions: Read-Ahead Material n For project being reviewed questionnaires ¨ scenarios (These are created

Preconditions: Read-Ahead Material n 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. ) ¨ n For review team description of architecture ¨ rationale for architecture ¨ n Ideally, material will address the review questions. (Passing this test because the questions were known in advance is not cheating, but good engineering!) 理想情况,材料要能说明评审时的问题 2/22/2021 © sun@hit. edu. cn 29

Preconditions: Ranked Quality and Behavioral Requirements n n Plan to examine three to five

Preconditions: Ranked Quality and Behavioral Requirements n n Plan 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. 一个专门的体系结构表述媒体(语言)目前并不是 必须的。由项目成员来讲解信息,表述的形式并 不重要 2/22/2021 © sun@hit. edu. cn 30

Review Activities n Evaluate ¨ “Run” the scenarios and ask the questions, or answer

Review Activities n Evaluate ¨ “Run” the scenarios and ask the questions, or answer the items in the checklist. 按场景执行,并询问相关问题;或者回答问卷里的问 题 ¨ Perform the experiments. (演示实验) ¨ Execute the prototypes or simulations. 运行原型或仿真程序 n Record ¨ critical issues highlighted in the review 评审中发现的严重问题 ¨ comments of project members on these issues 项目成员对这些问题的说明 2/22/2021 © sun@hit. edu. cn 31

Review Activities n Rank the issues ¨ project-threatening(生死攸关) ¨ major ¨ minor n Each

Review Activities n Rank the issues ¨ project-threatening(生死攸关) ¨ major ¨ minor n Each issue raised should be addressed in terms of ¨ changing the architecture ¨ relaxing the requirements 2/22/2021 © sun@hit. edu. cn 32

Review Activities n Warning signs ¨ architecture forced 组织模式影响体系结构 to match organization ¨ top-level

Review Activities n Warning signs ¨ architecture forced 组织模式影响体系结构 to match organization ¨ top-level components 顶层组件数超过25个 number over 25 ¨ one requirement drives 一项需求决定整个设计 entire design ¨ architecture depends on alternatives in the operating system 体系受操作系统选择的影响 2/22/2021 © sun@hit. edu. cn 33

Review Activities n Warning signs ¨ choice of software components is dictated by hardware

Review Activities n Warning signs ¨ choice of software components is dictated by hardware personnel 由硬件人员选择软件组件 ¨ redundancy not needed for 面对可靠性时,不考虑冗余手段 reliability ¨ design is exception driven 零散的小的事件影响设计 ¨ no identifiable architect 没有确定的架构师 2/22/2021 © sun@hit. edu. cn 34

Output from Review n Set of ranked issues supporting data ¨ contained in formal

Output from Review n Set of ranked issues supporting data ¨ contained in formal report ¨ feedback to project ¨ n n Enhanced system documentation 增强的系统文档 Set of scenarios for future use 将来会用到的场景集 Identification of potentially reusable components 认定潜在的可重用组件 Estimation of costs and benefits 估算成本和收益 2/22/2021 © sun@hit. edu. cn 35

SAAM: Software Architecture Analysis Method 一种简单的基于场景的评审技术 2/22/2021 © sun@hit. edu. cn 36

SAAM: Software Architecture Analysis Method 一种简单的基于场景的评审技术 2/22/2021 © sun@hit. edu. cn 36

Qualities Are Too Vague for Analysis n Is the following system modifiable? 这个系统具有适应性吗? Background

Qualities Are Too Vague for Analysis n Is 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. 必须修改许多组件才能适应新的文件格式 ¨ n A reasonable answer is 一个合理的答案: ¨ yes with respect to changing background color 有,从改变背景色的角度来看 ¨ no with respect to changing file format 没有,从改变文件格式的角度来看 2/22/2021 © sun@hit. edu. cn 37

Qualities Are Too Vague for Analysis Qualities only have meaning within a context. 质量因素只在一定的上下文里才有意义

Qualities Are Too Vague for Analysis Qualities only have meaning within a context. 质量因素只在一定的上下文里才有意义 n SAAM specifies context through scenarios. SAAM通过场景指定上下文 n 2/22/2021 © sun@hit. edu. cn 38

Scenarios n n A scenario is a brief description of a stakeholder’s interaction with

Scenarios n n A scenario is a brief description of a stakeholder’s interaction with a system. 场景就是一个角色与系统交互过程的简单描述 When creating scenarios, it is important to consider all stakeholders. 建立场景的时候,一定要考虑到所有的角色 ¨ Customer、User、Developer、Maintainer、 Attacker…… n The scenarios that are of most interest in a SAAM evaluation are change scenarios. SAAM最关心的是变化场景 2/22/2021 © sun@hit. edu. cn 39

Steps of a SAAM Evaluation n n n Identify and assemble stakeholders 确认和召集角色 Develop

Steps of a SAAM Evaluation n n n Identify and assemble stakeholders 确认和召集角色 Develop and prioritize scenarios 制定场景,并排好优先级 Describe candidate architecture(s) 描述候选的体系结构 Classify scenarios as direct or indirect 把场景分类为直接场景和间接场景 Perform scenario evaluation 进行场景评估 Reveal scenario interactions 展现场景间的相互影响 Generate overall evaluation 整体评估 2/22/2021 © sun@hit. edu. cn 40

Step 1: Identify and Assemble Stakeholders Stakeholder Interest Customer Schedule and budget; usefulness of

Step 1: Identify and Assemble Stakeholders Stakeholder Interest Customer Schedule and budget; usefulness of system; meeting customers’ (or market’s) expectations End User Functionality, usability Developer Clarity and completeness of architecture; high cohesion and limited coupling of parts; clear interaction mechanisms Maintainer Maintainability; ability to locate places of change 2/22/2021 © sun@hit. edu. cn 41

Step 1: Identify and Assemble Stakeholders Stakeholder Interest System Administrator Ease in finding sources

Step 1: Identify and Assemble Stakeholders Stakeholder Interest System Administrator Ease in finding sources of operational problems Network Administrator Network performance, predictability Intergrator Clarity and completeness of architecture; high cohesion and limited coupling of parts; clear interaction mechanisms 2/22/2021 © sun@hit. edu. cn 42

Step 1: Identify and Assemble Stakeholders Stakeholder Interest Tester Integrated, consistent error handling; limited

Step 1: Identify and Assemble Stakeholders Stakeholder Interest Tester Integrated, consistent error handling; limited component coupling; high component cohesion; conceptual integrity Application Builder Architectural clarity, completeness; interaction mechanisms; simple tailoring mechanisms Representative of the domain Interoperability 2/22/2021 © sun@hit. edu. cn 43

Step 2: Stakeholders Develop and Prioritize Scenarios n Scenarios should be typical of the

Step 2: Stakeholders Develop and Prioritize Scenarios n Scenarios should be typical of the kinds of evolution that the system must support: 场景应该是系统必须支持的各种演化的典型: ¨ functionality ¨ development activities ¨ change activities n n Scenarios should represent tasks relevant to all stakeholders. 所有角色都应该能在场景中体现出来 Rule of thumb: 10 -15 prioritized scenarios 应该有10 -15个优先的场景 2/22/2021 © sun@hit. edu. cn 44

Step 3: Describe Candidate Architectures It is frequently necessary to elicit appropriate architectural descriptions.

Step 3: Describe Candidate Architectures It is frequently necessary to elicit appropriate architectural descriptions. 通常,对体系结构进行适当的描述是非常 重要的 n Structures chosen to describe the architecture will depend on the type of qualities to be evaluated. 以我们需要的质量为依据,选择用来描述 体系结构的结构 n 2/22/2021 © sun@hit. edu. cn 45

Step 4: Classify Scenarios n There are two classes of scenarios. Direct scenarios are

Step 4: Classify Scenarios n There 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. 间接场景是那些需要修改系统的场景 ¨ n n The classification depends upon both the scenario and the architecture. 场景的类型因系统而异 For indirect scenarios we gauge the order of difficulty of each change: e. g. a person-day, personweek, person-month, person-year. 对间接场景,我们要度量适应每个变化的难度( 作量) 2/22/2021 © sun@hit. edu. cn 46

Step 5: Perform Scenario Evaluation n For each indirect scenario identify the components, data

Step 5: Perform Scenario Evaluation n For each indirect scenario identify the components, data connections, control connections, and interfaces that must be added, deleted, or modified 明确其组件、数据连结件、控制连结件和要被增加、删除或修改 的接口 ¨ estimate the difficulty of modification 估算修改的难度 ¨ n n Difficulty of modification is elicited from the architect and is based on the number of components to be modified and the effect of the modifications. 修改的难度体现在被修改的组件个数和修改的效果 A monolithic system will score well on this step, but not on next step. 只有一个模块的系统在此项评估可以得到高分,但是…… 2/22/2021 © sun@hit. edu. cn 47

Step 6: Reveal Scenario Interactions n When multiple indirect scenarios affect the same components,

Step 6: Reveal Scenario Interactions n When multiple indirect scenarios affect the same components, this could indicate a problem. 当多个间接场景影响同一个组件时,可能引发问题 ¨ could be good, if scenarios are variants of each other 可能是好事,当场景是彼此的变体 n n ¨ could be bad, indicating a potentially poor separation of concerns 可能是坏事,说明模块划分有问题 n n 2/22/2021 change background color to green change background color to red port system to a different platform © sun@hit. edu. cn 48

Step 7: Generate Overall Evaluation n Not all scenarios are equal. 场景生来不平等 The organization

Step 7: Generate Overall Evaluation n Not all scenarios are equal. 场景生来不平等 The organization must determine which scenarios are most important. 必须明确哪些场景是最重要的 Then the organization must decide as to whether the design is acceptable “as is” or if it must be modified. 评审团得出结论,当前的体系结构设计可行,还 是必须要修改 2/22/2021 © sun@hit. edu. cn 49