Object-Oriented Programming principles
1. Single Responsibility Principle (the principle of clear object responsibilities)
Requirement: a single object can only do one thing and must be focused. There are many reasons for too many responsibilities that may cause changes, and the program is unstable. (High Cohesion, low coupling extension)
2. Open and closed principles (Core Principles)
Requirement: the design of the class should be modified as little as possible when the requirement changes. Instead, the class can be extended. Closed modification and open Extension
3. Dependency inversion principle (object-oriented essence)
Requirement: Based on interface programming, the high-level module calls the interface and the underlying module implements the interface to prevent the underlying changes from directly affecting the high-level.
4. Interface isolation principle
Requirement: Use as many dedicated Small interfaces as possible instead of the total interface to avoid interface complexity.
5. Lee's replacement principle
Requirement: In the inheritance relationship, child classes can replace parent classes. virtual machines can dynamically find specific child class objects based on parent variables to achieve polymorphism.