13 common definition of software architecture style architecture analysis, charts, advantages and disadvantages

I. Overview

A system software architecture of the framework , and the interface for up relationship between the description of each part from a higher level, comprising a main member , member properties and relationships between components .

By using the software architecture, modified to effectively analyze the needs of the user, the system easily, as well as reducing the risk program configuration.

With the ever increasing software size and complexity of increasingly higher frame architecture system design becomes more and more critical. The core problem is the software framework design architecture program can reuse already formed . This causes the concept of software architecture styles.

Second, the common style classification

Architectural styles formation is the result of many years of research and study engineering practice. A good and versatile architecture style is often a sign of maturity engineering and technology. After years of development, we have summed up a lot of sophisticated software architecture styles, such as:

  1. Style data stream: Batch and pipe / filter.
  2. Call / Return Style: Main / Sub, hierarchies, and C / S.
  3. Object-oriented style.
  4. Independent component Style: interprocess communication and event-driven.
  5. Virtual machine Style: interpreter and rule-based system.
  6. Data Sharing Style: database systems and Blackboard system.

Third, the architectural style

1. Line / filter architectural style

Idiomatic patterns:

Filters and pipes includes two elements. In this configuration, the filter member is called, is responsible for data processing. Each filter has a set of input and output ports, the input port receiving data from, after internal processing, is transmitted to the output port. Data through the connection between the adjacent filter transmission path between the connecting member can be regarded as the input data stream and output data stream, which is the pipeline.

Schematic:

 

advantage:

  1. Simplicity.
  2. Support reuse.
  3. The system is scalable and can be evolutionary.
  4. System concurrency (each filter may operate independently, the different sub-tasks may be performed in parallel, improving efficiency).
  5. Ease of system analysis.

Disadvantages:

  1. Systems engineering is a batch processing mode.
  2. Not suitable for designing interactive applications.
  3. Absence of a common data transmission standard, each filter needs to parse input data and the synthetic data.
  4. Error handling is difficult.

 

The compiler is a conventional example of the structure of the pipe style / filter system. The compiler of lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, and code generation target of several modules, the output of one module is input to another module. After the processing source independently of each module, the ultimate object program is generated. FIG compiler framework:

2. Object-oriented architectural style

Idiomatic patterns:

In object-oriented architecture, modular software engineering, information hiding, abstraction and reuse principles have been fully reflected. In this architecture, data representation and associated primitive operations are encapsulated in the abstract data type. In this style, the subject is a member, has become instance abstract data types. Between objects and objects to interact through function calls and procedure calls.

Schematic:

advantage:

  1. An object of external hide your details
  2. Object and operation data package together
  3. Inheritance and encapsulation method for an object to provide technical support taking

Disadvantages:

  1. If an object you want to call another object, you must know its logo and name
  2. It will have a ripple effect

3. event-driven architecture style

Idiomatic patterns:

Event-driven on the basis of the current system is over, to drive the entire application development based on event declaration and run.

The basic idea of event-driven architecture are : the external behavior of the system can be implemented by its handling of the incident. In this architecture, the members no longer directly call the process, but the event is declared. Other components of the process system may be registered in these events. When an event is triggered, the system will automatically call all registered course of this event. Therefore, a trigger event causes the process of calling other members.

Schematic:

advantage:

  1. Event declaration does not need to know which members will respond to things
  2. Improve the ability of software reuse
  3. Easy system upgrade

Disadvantages:

  1. To give up control of the means of calculation, the system is completely determined by
  2. There is a data-transmission problems

4. Layered Architecture Style

Idiomatic patterns:

In the hierarchical style, the system will be divided into a hierarchy.

Each layer has a degree of cohesion, the various components comprising the same level of abstraction, information hiding support.

Complex hierarchical system helps to divide into separate modules, thereby simplifying the design and implementation procedures.

By decomposition, the system functions can be divided into a number of well-defined layers, the higher layers are facing a specific problem, the lower layer has a generality.

每层都为上层提供服务,同时又利用了下层的逻辑功能。在分层体系结构中,每一层只对相邻层可见。层次之间的连接件是协议和过程调用。用以实现各层之间的交互。

 

原理图:

优点:

  1. 设计者可以将系统分解为一个增量的步骤序列从而完成复杂的业务逻辑。
  2. 每一层之多和相邻的上下两层进行交互。
  3. 只要给相邻层提供相同的接口。

缺点:

  1. 并非所有系统都能够按照层次来进行划分。
  2. 很难找到一种合适和正确的层次划分方法。
  3. 在传输数据是,需要经过多个层次。
  4. 多层结构难以调试。

5.C2 体系结构风格

惯用模式:

C2结构是一个层次网络,包括构件和连接件两种软件元素。构件和连接键都是包含顶部和底部的软件元素。构件和构件之间只能通过连接件进行连接,而连接件之间则可以直接进行连接。构件的顶部、底部分别与连接件的底部、顶部连接,连接件的顶部、底部也分别与连接件的底部、顶部连接。

在C2体系结构中,构件之间的所有通信必须使用消息传递机制来实现。构件之间所有传递的信息可以分为两种,一种是向上层构件发出服务请求的请求消息另一种是向下层构件发出指示状态变化的通知消息。连接件负责消息的过滤、路由、广播、通信和相关处理。

原理图:

优点:

  1. 可以使用任何编程语言来开发构件,构件重用和替换比较容易实现
  2. 具有一定的扩展能力,可以有多种不同粒度的构件
  3. 构件不需要共享地址空间,避免了共享全局变量所造成的复杂关系
  4. 具有良好的适应性
  5. 在C2体系结构中,可以使用多个工具集和多种媒体类型,能够动态地更新系统的框架结构

缺点:

  1. 构件和构件之间不允许直接相连
  2. 与某一个连接件相关联的构件和连接件的数目没有限制

6.数据共享 体系结构风格

定义:

数据共享风格也成为仓库风格。

在这种风格中,有两种不同类型的软件元素:一种是中央数据单元,也成为资源库,用于表示系统的当前状态;另一种是相互依赖的构件组,这些构件可以对中央数据单元实施操作。中央数据单元和构件之间可以进行信息交换,这是数据共享体系结构的技术实现基础。

根据所使用的控制策略不同,数据共享体系结构可以分为两种类型,一种是传统的数据库,另一种是黑板

如果由输入流中的事件来驱动系统进行信息处理,把执行结构存储到中央数据单元,则这个系统就是数据库应用系统。

如果由中央数据单元的当前状态来驱动系统运行,则这个系统就是黑板应用系统。

黑板是数据共享体系结构的一个特例,用以解决状态冲突并处理可能存在的不确定性知识源

黑板常用于信号处理,如语音和模式识别,同时在自然语言处理领域中也有广泛的应用,如机器翻译和句法分析。

 

原理图:

一个典型的黑板系统主要包括知识源、中央控制单元、控制单元。

优点:

  1. 便于多客户共享大量数据,而不必关心数据是何时产生的、由谁提供的及通过何种途径来提供
  2. 便于将构件作为知识源添加到系统中来

缺点:

  1. 对共享数据结构,不同知识源要达成一致
  2. 需要同步机制和加锁机制来保证数据的完整性和一致性,增大了系统设计的复杂度

7.解释器 体系结构风格

惯用模式:

解释器作为一种体系结构,主要用于构建虚拟机,用以弥合程序语义和计算机硬件之间的间隙。实际上,解释器是利用软件来创建的一种虚拟机,因此,解释器风格又被称为虚拟机风格

原理图:

优点:

  1. 能够提高应用程序的抑制能力和变成语言的跨平台移植能力。
  2. 实际测试工作可能费城复杂,测试代价极其昂贵,具有一定的风险性。

缺点:

  1. 由于使用了特定了语言和自定义操作规则,因此增加了系统运行的开销。
  2. 解释器系统难以设计和测试。

8.反馈控制环 体系结构风格

定义:

反馈控制环是一种特定的数据流结构。传统数据流结构是线性的,而控制连续循环过程的体系结构应该是环形的。

反馈控制环系统主要包括以下三个部分:

  1. 过程,指操纵过程变量的相关机制。
  2. 数据元素,指连续更新的过程变量,包括输入变量、控制变量、操纵变量和相关参考值。
  3. 控制器,通过控制规则来修正变量,收集过程的实际状态和目标状态,调节变量以驱动实际状态朝目标状态前进。

 

原理图:

优点:

  1. 过程控制是连续的,可以利用各种构件和相关规则来设计反馈控制环系统,实现各种功能。
  2. 反馈控制环结构能够处理复杂的自适应问题,机器学习就是一个例子。

缺点:

9.C/S 体系结构风格

惯用模式:

……

原理图:

优点:

  1. 客户机构件和服务器构件分别运行在不同的计算机上,有利于分布式数据的组织和处理。
  2. 构件之间的位置是相互透明的,客户机程序和服务器程序都不必考虑对方的实际存储位置。
  3. 客户机侧重数据的显示和分析,服务器则注重数据的管理。
  4. 构件之间是彼此独立和充分隔离的。
  5. 将大规模的业务逻辑分布到多个通过网络连接的低成本的计算机,降低了系统的整体开销。

缺点:

  1. 开发成本较高。
  2. 在开发C/S结构系统时,大部分工作都都集中在客户机程序的设计上,增加了设计的复杂度。
  3. 信息内容和形式单一。
  4. 如果对C/S体系结构的系统进行升级,开发人员需要到现场来更新客户机程序,同时需要对运行环境进行重新配置,增加了维护费用。
  5. 两层C/S结构采用了单一的服务器,同时以局域网为中心,因此难以扩展到Intranet和Internet。
  6. 数据安全性不高。

10.B/S 体系结构风格

惯用模式:

B/S结构是三层C/S体系结构的一种实现方式,主要包括浏览器,Web服务器和数据库服务器。B/S结构主要利用不断成熟的WWW技术,结合浏览器的多脚本语言,采用通用浏览器来实现原来需要复杂的专用软件才能实现的强大功能,节约了开发成本。

B/S体系结构的核心是Web服务器,可以将应用程序以网页的形式存放在Web服务器上。

当用户运行某个应用程序时,只需要在可以断的浏览器中输入响应的 URL,向 Web 服务器提出 HTTP 请求。

当Web 服务器接收 HTTP 请求之后,会调用相关的应用程序(Servlets),同时向数据库服务器发送数据操作请求。

数据库服务器对数据操作请求进行响应,将结果返回给Web服务器的应用程序。

Web服务器应用程序执行业务处理逻辑,利用 HTML 来封装操作结果,通过浏览器呈现给用户。在B/S结构中,数据请求、王爷生成、数据库访问和应用程序执行全部由Web 服务器来完成。

原理图:

优点:

  1. 客户端只需要安装浏览器,操作简单。
  2. 运用HTTP标准协议和统一客户端软件,能够实现跨平台通信。
  3. 开发成本比较低,只需要维护Web服务器程序和中心数据库。

缺点:

  1. 个性化程度比较低,所有客户端程序的功能都是一样的。
  2. 客户端数据处理能力比较差。
  3. 在B/S结构的系统中,数据提交一般以页面为单位,动态交互性不强,不利于在线事务处理。
  4. B/S体系结构的可扩展性比较差,系统安全性难以保障。
  5. B/S结构的应用系统查询中心数据库,其速度要远低于C/S体系结构。

11.公共对象请求代理(CORBA)体系结构风格

惯用模式:

公共对象请求代理(Common Object Request Broker Architecture,CORBA)是由对象管理组织(Object Management Group,OMG)提出来的,是一套完整的对象技术规范,其核心包括标准语言、接口和协议。

在异构分布式环境下,可以利用CORBA来实现应用程序之间的交互操作,同时,CORBA也提供了独立于开发平台的编程语言的对象重用方法。

 

原理图:

优点:

  1. 实现了客户端程序与服务器程序的分析。
  2. 将分布式计算模式与面向对象技术结合起来,提高了软件复用率。
  3. 提供了软件总线机制,软件总线是指一组定义的完整的接口规范。
  4. CORBA能够支持不同的编程语言和操作系统,在更大的范围内,开发人员能够相互利用已有的开发成果。

缺点:

12.正交 体系结构风格

惯用模式:

正交体系结构是一种以 垂直线索构件族 为基础的层次化结构,包括组织层线索

在每一个组织层中,都包含具有相同抽象级别的构件。

线索是子系统的实例,是由完成不同层次功能的构件通过相互调用而形成的,每一条线索完成系统的一部分相对独立的功能。

在正交体系结构中,每条线索的实现与其他线索的实现无关或关联很少。在同一层次中,构件之间不存在相互调用关系。

原理图:

优点:

  1. 结构清晰。
  2. 便于修改和维护。
  3. 易于重用。

缺点:

13.MVC 体系结构风格

惯用模式:

模型-视图-控制器(Model-View-Controller,MVC)是一种常见的体系结构风格。MVC被广泛应用与用户交互程序的设计中。

原理图:

优点:

  1. 多个视图与一个模型相对应
  2. 具有良好的移植性。
  3. 系统被分割为三个独立的部分,当功能发生变化时,改变其中的一个部分就能够满足要求。

缺点:

  1. 增加了系统设计和运行复杂性。
  2. 视图与控制器连接过于紧密,妨碍两者的独立复用。
  3. 视图访问模型的效率比较低。
发布了57 篇原创文章 · 获赞 9 · 访问量 3597

Guess you like

Origin blog.csdn.net/Jayphone17/article/details/103651076