Chapter6:Architecture:SE_Notes《软件工程》笔记
文章目录
- Chapter6:Architecture
- 6.1 Architecture
- 6.1.1 What is architecture design?
- 6.1.2 architecture有大有小:
- 6.1.3 architecture 的作用?
- 6.1.4 Architecture和System characters
- 6.2 Architecture Views
- 6.3 Architecture patterns
- 6.3.1 What is architecture patterns ?
- 6.3.2 MVC pattern
- 6.3.2 Layered pattern
- 6.3.3 Repository pattern
- 6.3.4 Client-Server pattern
- 6.3.5 Pipe and filter pattern
- 6.4 Application architectures
Chapter6:Architecture
6.1 Architecture
6.1.1 What is architecture design?
-
架构设计,说到底还是一个设计过程,在system design process的早期阶段进行,并且是和需求分析specification同步进行的,最终产出一个software architecture的description。
这个description描述了系统的sub-system之间的control和communication
-
举例:packing robot control system
描述了有7个sub-system,以及他们之间的控制和交互情况。
6.1.2 architecture有大有小:
1)small:
一个程序被分解为若干的组件【甚至是对象类】
an individual program is decomposed into components.
2)large:
复杂的企业级系统,可能包含other systems, programs, and program components.
这些系统可能分布在不同的computers上,甚至被不同的companies管理着。
6.1.3 architecture 的作用?
-
Stakeholder Communication
利于stakeholders交流
-
System analysis
利于检测系统对non-functional requirements的满足程度。
-
Large-scale reuse
利于在相同的domain下复用。还利于建造出style
6.1.4 Architecture和System characters
6.2 Architecture Views
6.2.1 What is architecture view?
每一个architecture model 都只展现了 1 个 view or perspective of the system
我们要对系统进行设计、写文档,我们就需要不同的views,因而需要不同的architecture model
6.2.2 (4+1) view
分别面向四种人:
综合举例:
6.3 Architecture patterns
6.3.1 What is architecture patterns ?
对于一些具体domain的软件问题,可能会有相同的解决方案。
我们将:能解决一类特定问题的体系结构设计,称之为:architecture patterns
6.3.2 MVC pattern
- Model-view-controller pattern 三个逻辑部件组成,彼此互相交互。
-
Model:管理数据,封装数据。
-
View:展示数据,可视化。
-
controller:控制数据流向模型对象,并在数据变化时更新视图。它使视图与模型分离开。
- 例子:Web application 使用 MVC pattern
6.3.2 Layered pattern
-
用于建模子系统的接口 model the interfacing of sub-systems 。
组织成一系列的层的集合,每一层提供一层功能【例如计网中的模型】
能很好的支持:Incremental 增量式开发和交付
-
A generic layered architecture 通用的层次结构
-
例子:The architecture of the LIBSYS system
6.3.3 Repository pattern
-
sub-systems 之间如果需要 exchange data ,该怎么办?
两种方法:
-
Shared data is held in a central database or repository 【这就是仓库模型】
-
Each sub-system maintains its own database
-
-
特点:
数据存储:中心存储的,都放在一个repository里。
适用于:系统有大量的数据且需要长期保留。Data-driven的。
优点:组件独立,彼此影响小。数据一致性容易得到保证。
缺点:数据是中心存放的,它崩了就全崩了。组件之间需要通过中间商,效率低了些。
-
例:A repository architecture for an IDE
6.3.4 Client-Server pattern
-
Client-Server pattern
Client:提交服务请求。
Server:处理请求并返回结果。
好处:功能易扩展(加server就行)
种类:Two-tier 和 Multi-tier 两种。
-
Thin & Fat client
-
Thin-client model:客户端承担少,比如浏览器。
-
Fat-client model:客户端承担多,比如ATM取款机。
-
-
Two-tier client server
比如QQ就是2层结构。Two-tier又分为两种:
-
Multi-tier client server
系统有很多个client-server的层次。
每个层次 提供的功能是递进的【比如浏览器】。
通常是Thin-client
6.3.5 Pipe and filter pattern
-
管道过滤器【一种传统的architecture】
UML活动图描述:数据流图,功能转换过程。
数据处理模型中的每一个活动,就是一个功能处理模块,即:filter
数据流入流出的处理,即:pipe
典型的pipe and filter architecture有:Unix的Shell
-
例子:
管道—过滤器结构就是:数据流的处理过程的转换。箭头:管道,即:pipe
活动:处理活动,即filter
整个过程中,Invoices 和 Payments 经过一系列的过滤器 + 管道,最后得到了 Receipts 和 Reminders
6.4 Application architectures
-
What is Application architectures?
-
之前介绍的都是一些通用的 architectures或者patterns,对于一些特定的应用呢,也有一些architectures,这就是Application architectures
-
包含了前面通用模型,在具体应用中的体现。仓库模型的编译系统,层次模型的信息系统等。
-
-
The structure of transaction processing applications