ch01-intro
理解软件工程
- Software 和 Engineering
- Software 和 Hardware
- 软件是不可见的:软件是虚拟的,而硬件是实体的。
- 软件制作出来就是为了被修改和改变的(软件的演化是他的本质属性)
- Science vs. Engineering:科学的研究是研究这个世界既有的部分,而工程是研究的是人类创造新的世界(是不是因为人才产生的),下面的图是很重要的。
什么软件体系结构?
- 定义:“程序的软件架构或计算系统是系统,包括软件元素,这些元素的外部可见属性,以及其关系
- 定义2:一个系统的基本组织,体现在其组成部分、它们彼此之间的关系和环境以及支配其设计和演变的原则中
[EEE 1471-2000]
架构和设计 Architecture vs. Design
- 体系结构是关于软件设计 It’s about software design
- 所有的体系结构都是软件设计,但不是所有的软件设计都是体系结构
- All architecture is software design, but not all design is software architecture
- 体系结构是设计过程的一个过程
- “Architecting” is part of the design process
- 所有的体系结构都是软件设计,但不是所有的软件设计都是体系结构
- 其他观点 Other views
- 体系结构是更高层的设计 High-level designs
- 体系结构是设计决策的组合 A set of design decisions
- 体系结构是根据不同项目而不同的 Locality
- 系统的结构或组织 Structure/Organization of the system
- 元素(Elements):部件(Components)和连接件(Connectors) Elements: components & connectors
- 关系:静态(static)和动态(dynamic)的关系 Relationships: static & dynamic relationships
- 属性:元素,元素组和整个系统 Properties: elements, groups of elements & overall system
体系结构 vs 结构 Architecture vs. Structure
- 体系结构将系统分解成部件/模块/子系统,降低每一部分的复杂度 Decomposition of system into components/modules/subsystems
- 体系结构定义 Architecture defines
- 部件接口:部件可以做什么?Component interfaces: What a component can do?
- 部件交流和依赖:部件可以怎么沟通交流?Component communications and dependencies:How components communicate?
- 部件职责:当我们询问它时,部件需要精确的知道自己将要做什么?Component responsibilities:Precisely what a component will do when you ask it?
结构和体系结构 Structure and Architecture
![]() |
![]() |
---|---|
左图是对于结构的描述 | 右图是对于体系结构的描述 |
- 图中左侧的设计:第三方的模块与其他的四个模块直接耦合
- 图中右侧的设计:我们加入了AL模块来屏蔽了变化
体系结构确定通信 Architecture Specifies Communication
-
通信需要 Communication involves:
-
数据
通过机器传递,比如 Data passing mechanisms, for example:
- 函数调用 Function call
- 远程方法调用 Remote method invocation
- 异步信息 Asynchronous message
-
控制
流 Control flow
- 组件间的信息流来满足需要的功能 Flow of messages between components to achieve required functionality
- 序列化的 Sequential
- 并发/并行 Concurrent/parallel
- 同步 Synchronization
-
体系结构强调非功能性需求(NFA) Architecture Address NFRS
- 非功能性需求(Non-functional requirements)定义了系统运行的有多好 Non-functional requirements (NFRs) define "how well a system works?
- 当然也需要考虑功能性需求。
- 非功能性需求很少在功能性需求中很少被发现 NFRs rarely captured in functional requirements
- 又名体系结构需求 Aka. architecture requirements
- 必须通过体系结构引出 Must be elicited by architect
- 非功能性需求 NFRs include
- 技术约束 Technical constraints
- 商业约束 Business constraints
- 质量属性 Quality attrilbutes
- 讨论:质量属性列表 Discussion: A list of quality attributes?
软件质量属性
常见的软件质量属性有多种,例如
- 性能(Performance)
- 可用性(Availability)
- 可靠性(Reliability)
- 健壮性(Robustness)
- 安全性(Security)
- 可修改性(Modification)
- 可变性(Changeability)
- 易用性(Usability)
- 可测试性(Testability)
- 功能性(Functionality)
- 互操作性(Inter-operation)等。
具体含义是:
(1)性能(Performance)是指系统的响应能力,即要经过多长时间才能对某个事件做出响应,或者在某段时间内系统所能处理事件的个数。
(2)可用性(Availability)是系统能够正常运行的时间比例。
(3)可靠性(Reliability)是指软件系统在应用或错误面前,在意外或错误使用的情况下维持软件系统功能特性的基本能力。
(4)健壮性(Robustness)是指在处理或环境中,系统能够承受压力或变更的能力。
(5)安全性(Security)是指系统向合法用户提供服务的同时能够阻止非授权用户使用的企图或拒绝服务的能力。
(6)可修改性(Modification)是指能够快速地以较高的性能价格比对系统进行变更的能力。
(7)可变性(Changeability)是指体系结构经扩充或变更成为新体系结构的能力。
(8)易用性(Usability)是衡量用户使用一个软件产品完成指定任务的难易程度。
(9)可测试性(Testability)是指软件发现故障并隔离、定位其故障的能力特性,以及在一定的时间和成本前提下,进行测试设计、测试执行的能力。
(10)功能性(Functionality)是系统所能完成所期望工作的能力。
(11)互操作性(Inter-operation)是指系统与外界或系统与系统之间的相互作用能力。
设计是一种抽象 Design is an Abstraction
- 体系结构提供了设计的更高层抽象视角 Architecture provides an higher level abstract view of a design
- 隐藏设计的复杂性和实现 Hides complexity and implementation of design
- 可能是或者可能不是体系结构元素和软件元素之间的直接映射 May or may not be a direct mapping between architecture elements and sottware elements
- 黑盒设计 和 白盒设计 Blackbox design and Whitebox design
- 是对系统结构和交互的非正式描述Informal depiction of system’s structure and interactions.
- 描述在体系结构中内嵌的设计哲学Portray the design philosophies embodied in the
architecture
- 讨论:为什么在设计中使用抽象?Discussion: Why abstraction in design?
体系结构视图 Architecture Views
- 体系结构视图主要是为了应对软件不可见的问题,屏蔽其他没有影响的部分,将关注点进行分离
- 软件体系结构代表了一个复杂的设计制品 A software architecture represents a complex design artifact
- 很多体系结构的可能视图:类比建筑-平面图,外部设计,电力设计,水暖,空气调节 Many possible ‘views’ of the architecture:Analogy with buildings-floor plan, external, electrical, plumbing, air-conditioning
如何创建一个设计 How to Develop a Design?
- 广义的设计策略 Generic Design Strategies:
- 分解 Decomposition
- 抽象 Abstraction
- 逐步的:分而治之 Stepwise:Divid and Conquer
- 生成和测试 Generate and Test
- 迭代:渐进式细化 Iteration: Incremental Refinement
- 重用元素 Reuseable elements
K.Kruchen的4+1视图模型 P.Krutchen’s 4+1 View Model
- 逻辑视图:描述了体系结构中在体系结构上明显重要的元素以及他们之间的关系Logical view: describes architecturally significant elements of the architecture and the relationships between them
- 过程视图:描述了体系结构中的并发和交流元素 Process view: describes the concurrency and communications elements of an architecture.
- 物理视图:描述了主要过程和部件是如何映射到应用硬件上的 Physical view: depicts how the major processes and components are mapped on to the applications hardware.
- 发展视图:描述了软件部件是如何在软件内部组织的,比如配置管理工具Development view: captures the internal organization of the software components as held in e.g./ a configuration management tool.
- 使用体系结构的情况:描述了体系结构的需求,关系到了超过一个常规的视图Architecture use cases: capture the requirements for the architecture; related to more than one particular view
- 四个视图在某一个场景下进行描述
体系结构和软件体系结构 Architect & Software Architect
体系结构设计了满足人类需求的结构 Architects design structures to meet human needs. - James Fitch, 1972
- 体系结构的作用仍然保持着一致 The role of the architect remains the same
- 倾听用户,理解整体的需求 Listening to clients, understanding the totality of needs
- 仔细检查灵活性 Scrutinizing feasibilities
- 形成一个实际的结构版本,创建一个蓝图 Forming a practical vision of a structure and creating a blueprint
- 监督构建过程,保证是符合规范的 Overseeing construction and ensuring compliance to the plan
- 引导在暴风雨式的设计变更、危机和歧义性中的版本 Guiding the vision through the tempest of design changes, crises and ambiguities
- 软件体系结构则是监督软件的构建过程:开发人员、工程师和设计者 Software architects oversee software construction professionals Programmers, Engineers, Designers
- 有名的软件体系结构
- Bill Gates: Chief Software Architect of Microsoft
- Tim Bernrs-Lee: Inventor and Chief Architect of World Wide Web
- Roy Fielding: Representational State Transfer (REST)
软件体系结构在做什么 What Does a Software Architect Do?
- 联络人 Liaison
- 在客户、技术团队和商业/需求分析师之间 Among clients, technical team and business/requirements analysts
- 包含管理和市场分析 With management or marketing
- 软件工程:软件工程的最佳实践 Software Engineering:Software engineering best practices
- 技术知识:深入理解技术领域 Technology Knowledge:Deep understanding of technology domain
- 风险管理:Risk Management
- 与设计、技术决策相关的风险 Risks associated with the design, technology choices
- 更多?More?
总体设计模型 A General Design Model
开发和设计是在做减法
软件设计过程 Software Design Process
感觉这两张图还蛮重要的,是少有的人话
体系结构活动 Architecture Activities
- 创建系统的商业案例 Creating the business casenfor the System
- 理解需求 Understanding the requirements
- 创建和选择体系结构 Creating and selecting architecture
- 沟通体系结构(涉众,包括开发商) Communicating the architecture (stakeholders including developers)
- 分析或评估体系结构 Analysing or evaluating the architecture
- 整体的方法论 Overall methodologies
- 具体技术的质量 Quality specific techniques
- 实现体系结构Implementing the architecture
- 保证和体系结构的一致性Ensuring contormance to an architecture
软件体系结构过程 Software Architecture Process
体系结构生命周期 Architecture Lifecycle
软件体系结构和体系结构知识领域 Software Design & Architecture Knowledge Areas
- 软件设计基本原理 Software Design Basic Concepts
- ==整体设计原理== General design concepts
- 上下文:软件发展生命周期-需求、设计、编码和测试 Context: software development life cycle - requirements, design, construction and testing
- 设计过程:决策、活动、可运行产品 Design process(role, activity, work product)
- 软件设计的使能技术 Enabling techniques for software design
- ==核心问题(技术):一致性、事件控制和处理、分发、异常处理、交互系统、持久化== Key Issues (technical): concurrency, control and handling of events, distribution, exception handling, interactive systems, persistence
- 软件结构和体系结构 Software Structure and Architecture
- 体系结构结构和视点 Architecture Structures and viewpoints
- 体系结构风格和模式(宏观体系结构) Architectural styles and patterns (macro-architecture)
- 设计模式(微观体系结构) Design patterns (micro-architecture)
- 软件设计方法Software Design Methods
- 体系结构方法,比如==属性驱动的设计== Architecture Methods (e .g., Attribute- Driven Design)
- 设计方法,比如==动态系统发展方法== Design Methods (e.g., Dynamic System Development Method)
- 软件设计的==质量分析和评估== Software Design Quality Analysis and Evaluation
- ==质量属性== Quality attributes
- ==质量分析和评估方法、技术和工具== Quality analysis and evaluation methods, techniques and tools
- 设计回顾:比如SEI的体系结构权衡分析方法 Design reviews (e.g. SEI’s Architecture Trade-off Analysis Method)
- 静态分析和动态分析 Static analysis and dynamic analysis
- 模拟和原型 Simulation and prototyping
- ==度量== Measures:
- 矩阵:体系结构级别 Metrics: Architecture level
- 技术特有度量指标 Technique specific measures
- 设计建模和展示 Design Modeling and Representation
- 体系结构和设计符号(体系结构描述语言,Architecture Description Languages,ADL)Architecture and Design Notations (Architecture Description Languages(ADL))
- UML Unified Modelling Language (UML)
- 设计文档(意见或其他) Design Documentation (Views & Beyond)
- 其他:在活动、关注点和领域上的不同,比如ACME,Rapide。 Others: differ in ability, focus and domain (e.g. ACME, Rapide)
讨论
- 科学和工程有什么不同?What is Difference between Science and Engineering?
- 科学的研究是研究这个世界既有的部分
- 工程是研究的是人类创造新的世界(是不是因为人才产生的)
- 软件和硬件有什么不同?What is Difference between ‘Software’ and ‘Hardware’?
- 软件是不可见的:软件是虚拟的,而硬件是实体的。
- 软件制作出来就是为了被修改和改变的(软件的演化是他的本质属性)
- 体系结构和设计有什么不同?What is Difference between Architecture and Design?
- 所有的体系结构都是软件设计,但是不是所有的软件设计都是体系结构
- 体系结构是设计过程的一个过程。
- 其他观点
- 体系结构是更高层的设计,是为了修改的
- 体系结构是设计决策的组合
- 体系结构和结构有什么不同?What is Difference between Architecture and Structure?
- ==体系结构定义了组件(Component)的接口,Component之间如何交流以及如何相互依赖,Component的职责==。
- ==体系结构提供了设计的更高层抽象视角,隐藏设计的复杂性和实现,更强调非功能性需求==。
- 【标准】==架构是包括结构信息的,因为结构是一种静态的、逻辑的、是关于系统如何构成。但是架构除了包含结构,还会增加组件的相互之间的关系接口,还会定义一些动态的行为(一个组件可能和谁进行交互)==