Design principles,
I. Single Responsibility Principle
For a class, there should be only one reason for its change. If you can think of more than one motivation to change a class, then this class has more than one responsibility.
Ii. Opening-closing Principle
Changes are closed and extensions are open. in the face of requirements, changes to the program are implemented by Adding Code, rather than changing the existing code to maintain relatively stable. how can this problem be achieved? Class that is most likely to change in prediction. Abstract isolation is constructed. When a class is not predicted, an abstract class is created to isolate it to avoid similar changes in the future.
Iii. Principle of dependency reversal
A: High-Level modules should not depend on low-level modules. Both of them should depend on abstraction.
B: Abstraction should not depend on details. Details should depend on abstraction (for interface programming, not for implementation programming ).
Iv. Li's replacement principle
The child type must be able to replace its parent type (because the child type can be replaced, the module that uses the parent class can be expanded without modification)