面向对象设计(OOD) 包原则
2008-11-07 09:46
253 查看
1、Stable Abstractions Principle (SAP):稳定抽象等价原则
Packages that are maximally stable should be maximally abstract. Instable packages should be concrete. The abstraction of a package should be in proportion to its stability.
最稳定的包应该是最抽象的包。不稳定的包应该是具体的包。包的抽象程度跟它的稳定性成正比。
2、Stable Dependencies Principle (SDP):稳定依赖原则
The dependencies between packages in a design should be in the direction of the stability of the packages. A package should only depend upon packages that are more stable that it is.
一个设计中的包之间的依赖应该朝着稳定的方向进行。一个包只应该依赖那些比自己更稳定的包。
3、The dependency structure between packages must be a directed acyclic graph (DAG). That is, there must be no cycles in the dependency structure.
包之间的依赖结构必须是一个直接的无环图形(DAG)。也就是说,在依赖结构中不允许出现环(循环依赖)。
4、The Common Closure Principle (CCP):共同封闭原则
The classes in a package should be closed together against the same kinds of changes. a change that affects a package affects all the classes in that package.
一个包中所有的类应该对同一种类型的变化关闭。一个变化影响一个包,便影响了包中所有的类。
5、The Common Reuse Principle (CRP):全部重用原则
The classes in a package are reused together. If you reuse one of the classes in a package, you reuse them all.
包的所有类被一起重用。如果你重用了其中的一个类,就重用全部。
6、The Release Reuse Equivalency Principle (REP):重用发布等价原则
The granule of reuse is the granule of release.重用粒度等价于发布粒度。
Packages that are maximally stable should be maximally abstract. Instable packages should be concrete. The abstraction of a package should be in proportion to its stability.
最稳定的包应该是最抽象的包。不稳定的包应该是具体的包。包的抽象程度跟它的稳定性成正比。
2、Stable Dependencies Principle (SDP):稳定依赖原则
The dependencies between packages in a design should be in the direction of the stability of the packages. A package should only depend upon packages that are more stable that it is.
一个设计中的包之间的依赖应该朝着稳定的方向进行。一个包只应该依赖那些比自己更稳定的包。
3、The dependency structure between packages must be a directed acyclic graph (DAG). That is, there must be no cycles in the dependency structure.
包之间的依赖结构必须是一个直接的无环图形(DAG)。也就是说,在依赖结构中不允许出现环(循环依赖)。
4、The Common Closure Principle (CCP):共同封闭原则
The classes in a package should be closed together against the same kinds of changes. a change that affects a package affects all the classes in that package.
一个包中所有的类应该对同一种类型的变化关闭。一个变化影响一个包,便影响了包中所有的类。
5、The Common Reuse Principle (CRP):全部重用原则
The classes in a package are reused together. If you reuse one of the classes in a package, you reuse them all.
包的所有类被一起重用。如果你重用了其中的一个类,就重用全部。
6、The Release Reuse Equivalency Principle (REP):重用发布等价原则
The granule of reuse is the granule of release.重用粒度等价于发布粒度。
相关文章推荐
- 《OOD启思录》——60多条面向对象设计(OOD)经验原则
- 替换原则(LSP)--深度剖析--面向对象设计(OOD)
- 面向对象设计(OOD)中的单一职责原则
- 面向对象设计(OOD)原则
- 面向对象设计(OOD)七大原则
- 谈谈面向对象设计(OOD)原则
- 61条面向对象设计的经验原则(摘抄自《OOD 启示录》--Arthur J.Riel)
- 面向对象设计(OOD)中的单一职责原则
- 单一职责原则(SRP)--深度剖析--面向对象设计(OOD)
- 转- 面向对象设计(OOD)中的替换原则
- S.O.L.I.D 是面向对象设计(OOD)和面向对象编程(OOP)中的几个重要编码原则
- 面向对象设计(OOD)中的替换原则
- OOD之面向对象设计原则
- 面向对象设计(OOD)七大原则
- 读书笔记:面向对象设计(OOD)原则
- 面向对象设计原则
- 从设计模式Observer的实现看OOD的设计——浅谈“多态”的设计原则
- 61条面向对象设计的经验原则
- 【OOAD】面向对象设计原则概述
- 面向对象设计模式学习(一):面向对象设计模式与原则