In general, UML is actually four types of relationships and nine types of diagrams. Therefore, for UML syntax alone, it is very easy to grasp. The difficulty of UML is application. Different people have different opinions on the same system. However, a long-term process is required to ensure that the code written is basically the same as the image. You can draw a picture instead of understanding it. The following briefly summarizes the four relationships:
In UML, there are four relationships: Association, dependency, generalization, and implementation.
1. Association:
Associations can be divided into common associations, aggregation, and combination.
1. Common Association
Common associations are divided into one-way associations (navigation associations) and two-way associations. In addition, there can be multiple associations between the two classes. One class can also have multiple class associations and be associated with itself.
2. Aggregation
Aggregation is a special association. She represents the whole-part of the relationship. It is represented by a hollow diamond. The diamond points to the whole. The overall and partial coupling is loose.
3. Combination
A combination is also a special association. It is also the overall and part. However, the coupling between the overall and part expressed by the combination is relatively tight, and the part will not be created before the topic is created. Represented by solid diamond
Ii. Dependency
Dependency is a usage relationship. It indicates that the change in the specification of one thing may affect the use of another thing, but the opposite is not necessarily. It is represented by-->.
Iii. Generalization
A general relationship is a kind of "is-a-kind-of" relationship, that is, inheritance.
1. Single inheritance
That is, a subclass has only one parent class, for example
2. Multi-Inheritance
A class has two or more parent classes, for example
IV. Implementation
The semantic relationship between class elements during implementation. In this relationship, the contract for implementation of another class element is described with various plans.
The above are the four relationships in UML. When drawing a UML diagram, the application of the association relationship must be detailed.