Summary of java's six object oriented principles and one principle
- 2020-05-27 04:47:41
1. Single 1 responsibility principle: category 1 does what it should do.
2. Richter substitution principle: a subclass must be able to replace the base class (parent class), otherwise it should not be designed as a subclass.
3. Principle of dependency inversion: design should rely on abstraction rather than concretization.
4. Interface isolation principle: interface should be small and specialized, not large and complete.
5. Open and close principle: a software entity such as a class, module, and function should be open for extension and closed for modification.
6. Composition/aggregation reuse principle: use composition and aggregation as much as possible, and use inheritance relationships as little as possible to achieve reuse principle.
7. Demeter's law: low coupling, high cohesion.