面向对象设计(OOD) 包原则

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.重用粒度等价于发布粒度。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值