1. 将变化的部分封装起来(Encapsulate what varies)
  2. 组合优于继承(Favor composition over inheritance)
  3. 面向接口编程而非实现(Program to interfaces, not implementations.)
  4. 减少需要交互的类之间的耦合(Strive for loosely coupled designs between objects that interact)
  5. 对拓展开放,对修改关闭(Classes should be open for extension but closed for modification.)
  6. 依赖于抽象而非具体的类( Depend on abstraction. Do not depend on concrete classes)
  7. 暴露最少的信息给其他类(最少知识原则)(Talk only to your immediate friends)
  8. 高层有对底层的管理,而底层不需要关心高层何时会调用自己(好莱坞原则)(Don’t call us ,we’ll call you)
  9. 一个类应该有且只有一个被改变的理由(A class should have only one reason to change)