zoukankan      html  css  js  c++  java
  • software Architecture(2)

    过程调用体系结构风格

    1.软件体系结构风格:描述特定领域中软件体系家族的组织方式的惯用模式,反映了领域中众多系统所共有的结构和语义特性,并指导如何将各个模块和子系统有效地组织成一个完整的系统。

    2软件体系结构风格的组成:a set of component types,a set of connector types/interation mechanisms,a topological layout of these components,a set of constrains on topology an d behavior,an informal description of the costs and benefits of the style.

    经典体系结构风格的分类:

     

    2、Unstructured programming

    all the program code written in a single continuous main program.

    disadvantages for large programs:

    1) difficult to follow logic;

    2)if something needs to be done more than once must be-typed;

    3)hard to incorpirated other code;

    4)not easily modified;

    5)difficult to test praticular portions of the code.

    3、Hierarchical decomposition:

    the system is designed from a functional viewpoint,starting with a high-level view an d progressively refining this into a more detailed design.

    the methodology is exemplified by structured design and stepwise refinement.(结构化设计与逐步细化是这种风格的典型实例)

    hierarchical decomposition(逐步分解):

    based on definition-use relationship;uses procedure call as interaction mechanism;correctness of a subroutine depend on the correctness of the subroutines it calls(主程序的正确性依赖于它所调用的子程序的正确性).

    component(构件:主程序、子程序)

    connector(连接器:调用-返回机制)

    topology(拓扑结构:层次化结构)

    本质:将大系统分解为若干模块(模块化),主程序调用这些模块实现完整的系统功能。

    过程调用机制硬件基础(寄存器、跳转指令、栈操作指令)

    实现机制:栈。函数调用实际上是进行程序的跳转,在转去执行函数之前,应把现场保护起来(栈、寄存器),以备函数执行完毕还回到刚才跳转的地方,接着执行后继程序。

    主程序-子过程风格有点与缺点

    advantage:

    this has proved to be a highly sucessful design methodology.It has allowed the development of large programs.

    disadvantages:

    however,as program size increases beyond this point(10W行),the approach performs poorly;

    we obeserve that code development becomes too slow and that it becomes increamsingly difficult to test the software and guarance its reliablity. 

     

     

    4、Object-Oriented Style

    object is also called abstract data type;

    the system is viewed as a collection of objects rather than as functions with messages passed from object to obeject.

    eace objects has its own set of associated oprations.(每个对象都有一个它自己的功能集合。数据及作用在数据上的操作被封装成抽象数据类型——对象)

    information hidding

    encapsulation:

    an object is responsible for preserving the integrity of its presentation ,and the presentation is hidden from other objects.

    model the real world:

    program with nouns not verbs, entities defined by actions it suffers and requires(每个对象也定义了它所能执行的动作,以及可以作用在它上面的动作)

    component:classes and objects

    connectors:objects interact and procedure invocations.

    属性(Attribute):描述对象静态特性的数据项;

    操作(Operation):描述对象动态特性的一个动作;

    advantages of oo:

    reuse  and maintenance : Exploit encapsulation and locality to increase productivity (复用和维护:利用封装和聚合提高生产力)

    §Real world mapping: For some systems, there may be an obvious mapping from real world entities to system objects (反映现实世界)
    §Easy decomposition of a system: the bundling of a set of accessing routines with the data they manipulate allows designers to decompose problems into collections of interacting agents. (容易分解一个系统)

    Characteristics of OO:

    Encapsulation: Restrict access to certain information (封装:限制对某些信息的访问)

    Interaction: Via procedure calls or similar protocol (交互:通过过程调用或类似的协议)

    Polymorphism: Choose the method at run-time (多态:在运行时选择具体的操作)

    Inheritance: Keep one definition of shared functionality (继承:对共享的功能保持唯一的接口)

    Dynamic binding: Determine actual operation to call at runtime (动态绑定:运行时决定实际调用的操作)

    advantages:

    Reuse and maintenance: Exploit capsulation and locality to increase prodycrivity(复用和维护);real world mapping;easy decomposition of a system.

    disadvantages of oo:

    managements of many objects:Need structures on large set of definitions

    in order for one boject to interact with another(via procedure call) it must know

    the identity of that object.(必须知道对象的身份)

    –对比:在管道-过滤器系统中,一个过滤器无需知道其他过滤器的任何信息.
    inheritance introduces complexity and this

     

     

     

     

     
  • 相关阅读:
    【OpenCV】图像转成YUV420 I420格式
    【AdaBoost算法】强分类器训练过程
    【AdaBoost算法】弱分类器训练过程
    C# 8小特性
    string.PadLeft & string.PadRight
    string.Format对C#字符串格式化
    多线程调用同一个方法,局部变量会共享吗
    基于C#net4.5websocket客户端与服务端
    使用websocket-sharp来创建c#版本的websocket服务
    原来你是这样的Websocket--抓包分析
  • 原文地址:https://www.cnblogs.com/huhaibo/p/3403108.html
Copyright © 2011-2022 走看看