教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 文库大全 > 高中教育 >

2013武汉理工软件设计与体系结构复习(仅供参考)(3)

来源:网络收集 时间:2026-09-14
导读: 2.Open-Closed Principle (OCP) The OCP states that classes should be open for extension and closed for modification, in that you should be able to add new features and extend a class without changing

2.Open-Closed Principle (OCP)

The OCP states that classes should be open for extension and closed for modification, in that you should be able to add new features and extend a class without changing its internal behavior. The principle strives to avoid breaking the existing class and other classes that depend on it, which would create a ripple effect of bugs and errors throughout your application.

3.Liskov Substitution Principle (LSP)

The LSP dictates that you should be able to use any derived class in place of a parent class and have it behave in the same manner without modification. This principle is in line with OCP in that it ensures that a derived class does not affect the behavior of a parent class, or, put another way, derived classes must be substitutable for their base classes.

4.Interface Segregation Principle (ISP)

The ISP is all about splitting the methods of a contract into groups of responsibility and assigning interfaces to these groups to prevent a client from needing to implement one large interface and a host of methods that they do not use. The purpose behind this is so that classes wanting to use the same interfaces only need to implement a specific set of methods as opposed to a monolithic interface of methods.

5.Dependency Inversion Principle (DIP)

The DIP is all about isolating your classes from concrete implementations and having them depend on abstract classes or interfaces. It promotes the mantra of coding to an interface rather than an implementation, which increases flexibility within a system by ensuring you are not tightly coupled to one implementation.

1.单一职责原则

这个原则和关注点分离紧密联系。它陈述了每个对象应该只有一个理由去改变,单一聚焦在职责上。通过依附这个原则,你避免了庞大的类的设计问题,那就像瑞士的军刀。有了精确的对象,你再次增加了系统的可读性和可维护性。

2.开闭原则

这个原则陈述了类应该对扩展开放,对修改关闭,那样你就能够添加新的特征,扩展一个类而不用改变它内部的行为。这个原则旨在避免破坏存在的类及依赖它的其他类,这使得你的整个应用程序中产生故障和错误的涟漪。

3.Liskov替换原则

Liskov替换原则要求你应该能够使用任何衍生出的类代替父类,不用修改就有同样的行为。这个原则与开闭原则一致,它保证了一个衍生出的类不影响父类的行为,或者说,衍生出的类必须能够被它们的基类替代。

4.接口分离原则

这个原则是j将一个抽象方法分裂成几组职责,给这些组分配接口来防止客户端实现一个很大的接口,这个接口容纳了很多它们不使用的方法。目的是为了让类

2013武汉理工软件设计与体系结构复习(仅供参考) 软件

使用相同的接口只需要实现一些具体的方法,而不是有很多方法的庞大的接口。

5.依赖反转原则

把你的类从具体的实现中隔离开,使它们依赖于抽象类或接口。它促进了对接口而不是实现的译码,这通过保证对实现的低耦合来增加系统的灵活性。 企业应用架构在各层有那些主要的模式

三层架构的系统:表现层实现用户界面,在领域层实现领域逻辑,在数据源层存取数据

1.表现层(Presentation):

提供服务、显示信息(如在WINDOWS或HTML页面中,处理用户请求,HTTP请求,命令行调用,批处理API)

2.领域层(Domain):

领域逻辑,系统中真正的核心。也称为业务逻辑,它就是应用程序必须做的所有领域相关工作:包括根据输入数据或者已有数据进行计算,对从表现层输入的数据进行验证,以及根据从表现层接收的命令来确定应该调试哪些数据源逻辑。

3.数据源层(Data Source):

与数据库、系统消息系统、事务管理器及其他软件包通信。最主要的数据源逻辑就是数据库,主要责任是存储持久数据。

Larman的敏捷UP设计方法的具体步骤

(1) 初始:大体上的构想、业务案例、范围和模糊评估。

(2) 细化:已精化的构想、核心架构的迭代实现、高风险的解决、确定大多数

需求和范围以及进行更为实际的评估。

(3) 构造:对遗留下来的风险较低和比较简单地元素进行迭代实现,准备部署。

(4) 移交:进行beta测试和部署。

4+1视图

Logical view: describes architecturally significant elements of the architecture and the relationships between them.

Process view: describes the concurrency and communications elements of an architecture.

Physical view: depicts how the major processes and components are mapped on to the applications hardware.

Development view: captures the internal organization of the software components as held in e.g. a configuration management tool.

Architecture use cases: capture the requirements for the architecture; related to more than one particular view

逻辑视图:描述架构的重要元素及它们之间的关系

过程视图:描述架构元素之间的并发和通信

物理视图:描绘主要的过程和组件是如何映像到硬件上的

开发视图:俘获软件组件内部的结构,如配置管理工具

架构用例:俘获架构的需求;和不止一种视图相关

高可用性的常用策略

Transaction Script:

– New conditional, or

– New subroutine.

Domain Model:

2013武汉理工软件设计与体系结构复习(仅供参考) 软件

– Create new Rev. Recog. Strategy class.

事务脚本:新的约束或者是新产生的子程序

领域模型:构造新的收益确认策略类

答:Strategies for high availability:

Eliminate single points of failure

Replication and failover

Automatic detection and restart

消除单点故障

复制和故障转移

自动检测和重新启动

3 应用题

掌握命令模式,状态模式,观察者模式,策略模式,

单例模式,工厂方法模式,抽象工厂模式,组合模式

适配器模式,外观模式

命令模式(别名:动作,事务)

将一个请求封装为一个对象,从而使你可用不同的请求对客户进行参数化;对请求排队或记录请求日志,以及支持可撤消的操作。

状态模式(别名:状态对象)

允许一个对象在其内部状态改变时改变它的行为。

观察者模式(别名:依赖,发布-订阅)

定义对象间的一种一对多的依赖关系,当一个对象的状态发生变化时,所有依赖于它的对象都得到通知并被自动更新。

策略模式(别名:政策)

定义一系列算法,把它们一个个封装起来,并且使它们可相互替换。本模式使得算法可独立于使用它的客户而变化。

单件模式

保证一个类仅有一个实例,并提供一个访问它的全局访问点。

工厂方法模式(别名:虚拟构造)

…… 此处隐藏:2637字,全部文档内容请下载后查看。喜欢就下载吧 ……

2013武汉理工软件设计与体系结构复习(仅供参考)(3).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wenku/132152.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)