I. Single RESPONSIBILITY
A class should be a set of highly correlated functions, the encapsulation of data
Two. Opening and closing principle
Objects (classes, modules, functions, etc.) in the software should be open for expansion and closed for modification.
Explanation: During the software life cycle, because of changes, upgrade maintenance and other reasons need to modify the old code, this time may break the old code has been tested, so should try to expand to modify the code, rather than by modifying the old code to achieve.
In fact, in reality, the modification of the original code and expansion of the code is at the same time.
Three. Richter replacement
All references to base classes must be able to transparently use objects of their subclasses
Explanation: Subclasses can appear as long as the parent class can appear, and there is no problem replacing them with subclasses
Summary: Abstract
Four. Dependency inversion
1. High-level modules are not dependent on low-layer modules, both rely on abstract
2. Abstraction does not depend on details
3. Detail dependent on abstraction
Explanation: Dependencies between modules occur through abstraction, and there is no direct dependency between the implementing classes, and their dependencies are generated through interfaces or abstract classes.
In fact, it can be understood as interface-oriented programming, or abstract programming
Five. Interface Isolation principle
Make the client dependent on the interface as small as possible
"Reading" one, the six principles of object-oriented