All Projects → igo9go → phpDesignPattern

igo9go / phpDesignPattern

Licence: other
PHP中常用的设计模式的一些小demo

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to phpDesignPattern

Designpattern
📚 Java 23种设计模式全归纳
Stars: ✭ 2,709 (+4652.63%)
Mutual labels:  designpattern
design-patterns-for-humans-cn
Design patterns for humans 中文版 - 对设计模式超简单的解释
Stars: ✭ 2,432 (+4166.67%)
Mutual labels:  designpattern
work
A compact library for tracking and committing changes to your entities.
Stars: ✭ 50 (-12.28%)
Mutual labels:  designpattern
CodeProject
Common code for unity project develop.
Stars: ✭ 28 (-50.88%)
Mutual labels:  designpattern
refactoringtopatterns
A place to practice Refactoring To Patterns that Kerievsky wrote about in his book
Stars: ✭ 46 (-19.3%)
Mutual labels:  designpattern

PHP设计模式

面向对象的目标
  • 高内聚,低耦合
面向对象设计的基本原则
  1. 单一职责:一个类只做一件事
  2. 开闭原则:对扩展开放对修改关闭
  3. 里氏替换:子类必须能替换所有父类的使用
  4. 依赖倒置:设计依赖于抽象而不是实现
  5. 最少知识:对象应当尽可能少的去了解其他对象
  6. 接口隔离:接口倾向于小而多
  7. 组合优先:优先使用类的组合而不是继承

抽象类和接口的使用

  • 当类中有共同的行为或属性时,可以考虑使用 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].