Purpose: Read the code of the predecessors and design better software to solve the challenges of coupling, cohesion, maintainability, scalability, reusability, flexibility, etc.
Design Principles
Single Responsibility Principle (Single Responsibility Principle): For classes, that is, a class should only be responsible for one responsibility, in order to reduce class complexity, improve class readability and maintainability, and reduce the risk of changes
Interface Segregation Principle: The dependence of one class on another class should be established on the smallest interface to reduce implementation classes to implement unnecessary interface methods
Dependence Inversion Principle: Interface-oriented programming to reduce the coupling between customers and implementation modules
Liskov Substitution Principle: Subclasses can extend the functions of the parent class, but cannot change the original functions of the parent class to reduce errors in the process of program calling
Open Close Principle: The software entity should be open for extension and closed for modification. Make it have a certain degree of adaptability and flexibility, while having stability and continuity
The Least Knowledge Principle: That is, the less a class knows about the classes it depends on, the better, reducing the coupling between them
Composite Reuse Principle (Composite Reuse Principle): When software reuse, it is necessary to use association relationships such as combination or aggregation to achieve it first, and then consider the use of inheritance relationships to achieve
UML class diagram
The core of UML modeling is the model, which is the simplification of reality and the abstraction of real systems. In UML, all descriptions are composed of things, relationships, and diagrams.
Things : The final result of abstraction, divided into structural things, behavioral things, grouping things and annotation things.
Figure : UML2.0 has a total of 13 types of diagrams (9 types are defined in UML1.5, and 4 types are added to UML2.0)
. Relationships between classes : divided into association, aggregation, composition, and dependency (dependency), generalization (inheritance), realization (realization)