code > 370 - 架构匹配 > Flashcards
370 - 架构匹配 Flashcards
source code
Implementation/Development View
image files
Implementation/Development View
web pages
Implementation/Development View
DLLs
动态链接库
Implementation/Development View
executables
Implementation/Development View
data files
Implementation/Development View
A description of the organization (i.e., Java packages, JAR files) 组织结构描述(如Java包、JAR⽂
件)
Implementation/Development View
software assets
Implementation/Development View
off-the-shelf components
Implementation/Development View
Configuration management (ownership, release strategy)
Implementation/Development View
concurrency
Process View
parallelism
Process View
system startup and shutdown
Process View
fault
tolerance
Process View
components, layers
logical view
object distribution
Process View
Object Distribution(对象分布)指的是在分布式系统中,将对象(通常是面向对象编程中的对象实例)分布在多个计算机或节点上,以便它们可以在不同的物理位置之间进行交互和协作。对象分布允许不同位置的对象相互通信、共享资源和完成任务,形成一个虚拟的整体系统。
关键概念
远程对象:对象分布通常需要远程对象(Remote Object),即可以被其他节点上的对象远程调用的对象。这些对象可能通过网络进行通信,以响应远程的请求。
分布式对象系统:许多分布式系统(如Java RMI、CORBA、gRPC)都支持对象分布,使得开发者可以创建分布在不同机器上的对象,并让它们看起来像是在本地运行的一样。
代理模式(Proxy):在分布式系统中,通常会使用代理对象(或称“Stub”)来代表远程对象,帮助本地代码调用远程对象的方法。代理会将请求传递到远程对象,获取结果并返回给本地对象。
通信协议:对象分布通常需要依赖网络通信协议(如TCP/IP、HTTP)来实现远程调用和数据传输。
对象位置透明性:对象分布的一个目标是提供位置透明性,即让开发者可以忽略对象的实际位置,将分布式对象视为本地对象进行操作。
举例说明
假设一个电商系统将库存管理对象分布到不同的仓库服务器上,每个服务器管理本地库存数据。当用户下单时,系统可以通过对象分布的方式,远程调用库存对象的检查和更新方法。尽管这些库存对象位于不同的服务器上,系统仍然可以透明地操作它们,就像操作本地对象一样。
优缺点
优点:提高系统的扩展性和可用性,允许资源分布在多个位置,减轻单个服务器的负载。
缺点:增加了系统的复杂性和通信开销,网络延迟、数据一致性和错误处理也更具挑战。
典型应用
对象分布广泛应用于需要跨多节点协作的场景,如分布式数据库、微服务架构、分布式计算平台等。在这些系统中,对象分布使得多个服务器能够协作完成复杂任务,并对外提供统一的服务接口。
deadlock
Process View
response time
Process View
throughput
Process View
faults
Process View
reuse
Implementation/Development View
physical network configuration
Deployment/Physical View
subcontracting
Implementation/Development View
Subcontracting(分包)指的是将项目中的某些任务或部分工作外包给第三方公司或个人来完成。这种方法在项目管理、建筑、制造、软件开发等各个行业中都很常见。
Subcontracting 的工作原理
在分包过程中,主承包方(也称为总承包方)会与客户签订合同,负责项目的整体交付。而总承包方则会将一些特定任务或部分工作交给分包方完成。分包方通常具有某种特定的专业技能,能够在特定领域为主承包方提供支持。分包方完成的工作最后会汇总到主项目中,由总承包方对客户负责。
举例说明
假设一家公司承包了一个软件开发项目,其中包含前端开发、后端开发和测试。该公司可能会将测试工作分包给一家专业的测试公司,这样可以减少工作量,同时确保测试的专业性。
Subcontracting 的优缺点
优点:
降低成本:分包有时比自己完成更便宜,尤其是在需要专门技能的情况下。
提高效率:可以通过分包加快进度,因为不同部分可以同时进行。
利用专长:分包可以利用其他公司在特定领域的专业知识,提高项目质量。
缺点:
管理难度增加:需要协调多个分包方的进度和质量,增加了项目管理的复杂性。
质量风险:分包方的工作质量可能影响整个项目的质量。
沟通挑战:由于涉及多个团队,沟通可能变得困难,容易导致误解或信息延迟。
应用场景
分包在大型项目中非常常见,尤其是需要多种专业技能的项目。建筑行业、IT行业、制造业、服务业等都会使用分包来更好地分配资源、降低成本并提高效率。
Deliverables and things that create deliverables
Implementation/Development View
subsystems
Logical View
packages
Logical View
frameworks
Logical View
class
Logical View
interfaces
Logical View
Logical View
- Logical elements organized in terms of
- components, layers, subsystems, packages, frameworks, class, and interfaces 按组件、层、子系统、包、框架、类和接口组织的逻辑元素
- Addresses the functional requirements of the system 处理系统的功能需求
- “What should the system do for its end users?” “系统应为最终用户提供什么?”
- An abstraction of the design model 设计模型的抽象
- Identifies major design packages, subsystems and classes 确定主要设计包、子系统和类
- Interaction diagrams are used to illustrate significant system collaborations 使用交互图展示系统的显著协作
Object-Oriented Organization
描述
pros
cons
软件架构风格
Description:
1. Their associated primitive operations are encapsulated in an abstract data type or object.数据表示及其关联的基本操作被封装在一个抽象数据类型或对象中。
2. Objects are examples of a sort of component we call a manager because it is responsible for preserving the integrity of a resource.对象是一种我们称为管理者(manager)的组件,因为它负责维护资源的完整性
3. Objects interact through function and procedure invocations. 对象之间通过函数和过程调用进行交互。
通过类和对象组织代码,封装数据和操作,利用继承,封装,多态等特性来提高代码的复用性。
Pros:
1. An object is responsible for preserving the integrity of its representation
2. The representation is hidden from other objects.
3. Some systems allow “objects” to be concurrent tasks
4. Others allow objects to have multiple interfaces
5. An object hides its representation from its clients, it is possible to change the implementation without affecting those clients
Cons:
1. In order for one object to interact with another (via procedure call) it must know the identity of that other object.
2. Whenever the identity of an object changes it is necessary to modify all other objects that explicitly invoke it.
Call-and-return systems
Event-Based 事件驱动模式
基于事件的隐式调用(Event-Based, Implicit Invocation)
描述
pros
cons
例子
软件架构风格
Description:
The idea behind implicit invocation is that instead of invoking a procedure directly, a component can announce (or broadcast) one or more events. Other components in the system can register an interest in an event by associating a procedure with the event. When the event is announced the system itself invokes all of the procedures that have been registered for the event. Thus an event announcement ``implicitly’’ causes the invocation of procedures in other modules. 隐式调用的背后理念是,组件不直接调用过程,而是宣布(或广播)一个或多个事件。系统中的其他组件可以通过将一个过程与事件关联来注册对该事件的兴趣。当事件被宣布时,系统会自动调用所有已为该事件注册的过程。因此,事件的宣布“隐式地”导致了其他模块中过程的调用。
A component can announce (or broadcast) one or more events.
Other components in the system can register an interest in an event by associating a procedure with the event.
Examples: react to pushing a button; Debugging systems (listen for particular breakpoints)
pros:
1. One important benefit of implicit invocation is that it provides strong support for reuse. 隐式调用的一个重要好处是,它为重用提供了强有力的支持。
2. implicit invocation eases system evolution. Components may be replaced by other components without affecting the interfaces of other components in the system. 组件可以被其他组件替换,而不影响系统中其他组件的接口。
Cons:
1. The main invariant of this style is that announcers of events do not know which components will be affected by those events. Thus components cannot make assumptions about order of processing, or even about what processing, will occur as a result of their events.这种风格的主要不变特性是事件的宣布者并不知道哪些组件会受到这些事件的影响。因此,组件不能对处理顺序或这些事件引起的处理类型做任何假设。
- implicit invocation is that components relinquish control over the computation performed by the system. 组件放弃了对系统执行的计算的控制。
- When a component announces an event, it has no idea what other components will respond to it. Worse, even if it does know what other components are interested in the events it announces, it cannot rely on the order in which they are invoked. Nor can it know when they are finished. 当一个组件宣布事件时,它并不知道哪些其他组件会响应该事件。更糟的是,即使它知道哪些其他组件对其宣布的事件感兴趣,它也不能依赖它们被调用的顺序,甚至无法知道它们何时完成。
- Another problem concerns exchange of data. Sometimes data can be passed with the event. But in other situations event systems must rely on a shared repository for interaction. In these cases global performance and resource management can become a serious issue. 另一个问题涉及数据交换。有时数据可以与事件一起传递。但在其他情况下,事件系统必须依赖共享存储库进行交互。在这些情况下,整体性能和资源管理可能成为严重的问题。
例子:User interface (GUI),Debugging System监听特定断点
Independent components
分层架构
Description:
Each layer that provides service to the layer above it and serves as a client to the layer below it. 每一层为其上的层提供服务,并作为其下层的客户端。层与层之间的交互通常限制为相邻层之间。
In some layered systems inner layers are hidden from all except the adjacent outer layer, except for certain functions carefully selected for export.在一些分层系统中,内层对所有其他层(除相邻的外层)都是隐藏的,只有某些精心挑选的功能可以被导出。因此,在这些系统中,组件在层级结构的某一层实现了一个虚拟机。
pros:
First, they support design based on increasing levels of abstraction. This allows implementors to partition a complex problem into a sequence of incremental steps. 首先,它们支持基于逐级抽象的设计。这允许实现者将复杂问题分解为一系列渐进的步骤。
They support enhancement. Like pipelines, because each layer interacts with at most the layers below and above, changes to the function of one layer affect at most two other layers. 它们支持增强功能。像流水线一样,由于每层最多只与上下相邻层交互,对一层功能的更改最多只影响另外两个层。
They support reuse. Like abstract data types, different implementations of the same layer can be used interchangeably, provided they support the same interfaces to their adjacent layers.它们支持复用。像抽象数据类型一样,相同层的不同实现可以互换使用,只要它们支持相邻层的相同接口。
Cons:
Not all systems are easily structured in a layered fashion. (We will see an example of this later in the case studies.) And even if a system can logically be structured as layers, considerations of performance may require closer coupling between logically high-level functions and their lower-level implementations. 并非所有系统都能轻松地结构化为分层方式。(在后续案例研究中,我们将看到一个例子。)即使一个系统在逻辑上可以结构化为层,性能的考虑可能要求逻辑上高层的功能与其低层实现之间更紧密的耦合。
例子:
OSI 模型:开放式系统互联模型,它将网络通信分为7层
通信协议(Communication Protocol):一系列规则和约定,它规定了数据传输的格式,顺序,处理方式以及错误处理机制。
操作系统
数据库的访问层和逻辑层
Call-and-return systems: Main program and subroutine; OO systems;
Hierarchical layers
Repositories
描述
pros
cons
例子
架构风格
In a repository style there are two quite distinct kinds of components: a central data structure represents the current state, and a collection of independent components operate on the central data store. 在仓库风格中,有两种截然不同的组件类型:一个中央数据结构表示当前状态,一组独立组件在中央数据存储上进行操作。
黑板模型通常由三个主要部分组成:
The knowledge sources: separate, independent parcels of applicationdependent knowledge. Interaction among knowledge sources takes place solely through the blackboard.知识源:独立、分离的应用依赖知识单元。知识源之间的交互仅通过黑板进行。
The blackboard data structure: problem-solving state data, organized into an application-dependent hierarchy. Knowledge sources make changes to the blackboard that lead incrementally to a solution to the problem.黑板数据结构:问题解决状态数据,按照应用相关的层次结构组织。知识源对黑板进行更改,这些更改逐步引向问题的解决。
Control: driven entirely by state of blackboard. Knowledge sources respond opportunistically when changes in the blackboard make them applicable.控制:完全由黑板的状态驱动。当黑板的变化使知识源适用时,知识源就会主动响应。
一个黑板组件作为中央数据存储库,并且有一组独立的计算组件,这些组件独立地作用于存储在平台上的公共数据结构,响应其中的变化并进一步响应后续的变化。其工作方式是内部有一个非常类似于数据库的组件。你有一个大单元,然后有不同的模块或代理,通常这些是虚拟模块、虚拟代理。所以我有一个大任务,我将它分配给这些不同的虚拟代理或虚拟模块。这就是黑板架构的存储库。它不是数据库。
例子:
Speech recognition with multiple knowledge sources
* Image recognition with multiple knowledge sources
* Programming environments with shared repository of programs and program fragments
现代编译器
Data-centered-systems(repositories): Databases; Hypertext systems;
Blackboards