OO的一些基本特性
- 封装(Encapsulation)
- 继承(Inheritance)
- 多态(Polymorphism)
- 内聚(cohesion)
- 耦合(coupling)
进行OO设计的5个原则 (SOLID)
- 单一职责原则(SRP - Single Responsibility Principle)
A CLASS SHOULD HAVE ONLY ONE REASON TO CHANGE.
- 开放封闭原则(OCP - Open-Closed Principle)
You should be able to extend a classes behavior, without modifying it.
- 里氏替换原则(LSP - Liskov Substitution Principle)
Derived classes must be substitutable for their base classes.
- 接口隔离原则(ISP - Interface Segregation Principle)
Make fine grained interfaces that are client specific.
- 依赖倒置原则(DIP - Dependency Inversion Principle)
Depend on abstractions, not on concretions.
SRP
"There should never be more than one reason for a class to change." — Robert C. Martin
Principles of OO Design
原文:http://www.cnblogs.com/haibinyuan/p/4665668.html