1. Interface isolation principle
1. It is better to use multiple interfaces than to use a single interface
2. rational division of roles: an interface represents a role
3. Custom Service: divide an interface into interfaces with different widths to correspond to different customers
4. interface contamination
1 An interface encapsulates too many methods, and the Division is unreasonable
2 combines tasks of different roles into one interface
Principle of combined aggregation Reuse
1. Try to use combination aggregation instead of inheritance.
2. the inheritance is static, and the combination of aggregation and reuse can be dynamically determined at runtime.
4. When one category is another: for example, men and women are human beings, while formal and temporary employees are employees.
5. When a class has some roles, such as students, managers, and drivers. People may have three roles at the same time, so they must use combination aggregation for reuse. It is static for inheritance. People can only be students, managers, or drivers. Once confirmed, they cannot change. This certainly does not match.
Tridimit's Law
1. Do not communicate with a software entity unless it must communicate with another software entity
Four single responsibilities
1. A class can only be changed in one place, and only one place can be changed in one hierarchy,
Do not mix two changes