一些设计原则的汇总
几个简单易行的原则
DRY. don’t repeat yourself.
KISS. Keep it simple, stupid
YAGNI. You ain't gonna need it
class design principles
SOLID(wiki, article): SRP, OCP, LSP, ISP, DIP.
SRP(wiki, pdf): Single responsibility principle. A class should have one, and only one, reason to change.
OCP(wiki, pdf): Open/closed principle. You should be able to extend a classes behavior, without modifying it.
LSP(wiki, pdf): Liskov substitution principle. Derived classes must be substitutable for their base classes.
ISP(wiki, pdf): Interface segregation principle. Make fine grained interfaces that are client specific.
DIP(wiki, pdf): Dependency inversion principle. Depend on abstractions, not on concretions.
package cohesion principles
REP(pdf): The Release Reuse Equivalency Principle. The granule of reuse is the granule of release.
CCP(pdf): The Common Closure Principle. Classes that change together are packaged together.
CRP(pdf): The Common Reuse Principle. Classes that are used together are packaged together.
packages coupling principles
ADP(pdf): The Acyclic Dependencies Principle. The dependency graph of packages must have no cycles.
SDP(pdf): The Stable Dependencies Principle. Depend in the direction of stability.
SAP(pdf): The Stable Abstractions Principle. Abstractness increases with stability.
架构原则
- GRASP. wiki
关键字:principle, pdf, wiki, classes
版权声明
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处。如若内容有涉嫌抄袭侵权/违法违规/事实不符,请点击 举报 进行投诉反馈!