软件架构的样式与框架

构架样式(模式,pattern,style)—是对各组件类型和运行控制/数据传送模式的描述。可以把构架样式看作是对构架的一组制约条件,即对各组件类型及其交互模式的限制条件,而这些制约条件就确定了一组或一系列能满足它们的构架。
可以从四个方面理解构架样式:
   • 一组在系统运行时执行一定功能的组件类型。
   • 能够表明在系统运行时组件的相互关系的拓扑结构。
   • 一组语义约束条件的集合。
   • 一组连接件的集合,这些连接件为组件之间的通信提供中介。
 
构架样式是预先定义好的,稍加修改即可在给定环境下使用的“组块”,样式代表了一组已经做出并可重用的设计决策,而且这些决策构成了一个整体
软件架构样式的种类
 
nWhen we introduce a new style, we will typically first examine its “pure” form.
¨pure architectural style are rarely found in practice
纯粹的体系风格在实际中很难遇到
¨systems in practice
nregularly deviate from the academic definitions of these systems. 循规蹈矩地背离了对这些系统的学术定义
ntypically feature many architectural styles simultaneously
典型地,融合很多体系风格的特色
¨as an architect you must understand the “pure” styles to understand the strength and weaknesses of the style as well as the consequences of deviating from the style
作为一个架构师,你必须理解的风格。理解它的优点与缺陷,也要理解背离此种风格之后会带来什么结果
 
 
    • 数据流构架
    数据流构架的目标是实现可重用性和可更改性,它的特点是把系统看作是对相继输入数据的一系列变换。它可分成两个子样式
    成批顺序式—等到一个步骤全部处理完后才能开始下一个步骤,每个处理步骤(组件)是独立的程序,在各个步骤之间,数据是作为一个整体传送的。如传统的磁带处理。Batch Sequential(批处理)
    管道—过滤式 

Pipe-and-Filter

    管道负责数据传递,过滤器对数据进行渐进的转换。如UNIX系统中可以用此方法来过滤文件中一些不需要的字符。
 
演示:dir * | find ???  | sort
 

In a pure data flow system, there is no other interaction between processes 在纯数据流系统中,处理之间除了数据交换,没有任何其他的交互

nThere are variety of variations on this genera theme:
¨how control is exerted (e.g., push versus pull)
如何施加控制(比如:推还是拉)
¨degree of concurrency between processes
并行的程度
¨topology
 
 
 
nComponents: Data Flow Components
¨Interfaces are input ports and output ports
组件接口是输入端口和输出端口
¨Input ports read data; output ports write data
从输入端口读数据,向输出端口写数据
¨Computational model: read data from input ports, compute, write data to output ports
计算模型:从入口读数,计算,然后写到出口
nConnectors: Data Streams
¨Uni-directional(单向)
nusually asynchronous, buffered (通常是异步的,有缓冲)
¨Interfaces are reader and writer roles
接口是readerwriter
¨计算模型: 把数据从writer转向reader
nSystems
¨Arbitrary graphs(任意拓扑结构)
¨Computational model: functional composition(计算模: 功能组合)
 
    • 虚拟机构架
    虚拟机构架的目标是实现可移植性。虚拟机是模拟硬件功能或抽象软件环境的构架样式
    虚拟机构架常见的示例有解释程序、基于规则的系统、句法shell程序、命令语言处理器等。
 
    • 调用--返回构架
    调用返回构架一直是大型软件系统的主流构架样式,它的目标是实现系统的可更改性和可扩展性。它有多种子样式:
    主程序-子程序构架
    远程过程调用构架
    面向对象构架
    分层构架
 
 
原文地址:https://www.cnblogs.com/youxin/p/3514565.html