A place to practice Refactoring To Patterns that Kerievsky wrote about in his book
Stars: ✭ 46 (-19.3%)
Mutual labels: designpattern
PHP设计模式
面向对象的目标
高内聚,低耦合
面向对象设计的基本原则
单一职责:一个类只做一件事
开闭原则:对扩展开放对修改关闭
里氏替换:子类必须能替换所有父类的使用
依赖倒置:设计依赖于抽象而不是实现
最少知识:对象应当尽可能少的去了解其他对象
接口隔离:接口倾向于小而多
组合优先:优先使用类的组合而不是继承
抽象类和接口的使用
当类中有共同的行为或属性时,可以考虑使用 abstract calss
当类别中有共同的操作界面,但是在实现上有所差别,可以考虑使用 interface
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].