The meaning of symbols in UML class diagram

Class diagram basic symbols can be split into dashed line, arrow, solid line, hollow right triangle, solid right triangle, hollow diamond and solid diamond. The combination of these basic graphics constitutes the basic symbols of the class diagram. Pay attention to the order of these symbols here, which represents the degree of coupling between classes and classes. The further to the right the higher the coupling.

The dotted line + arrow indicates the relationship of dependencies, the solid line + arrow indicates the relationship of association, the dotted line + hollow right triangle indicates implements, and the solid line + hollow right triangle indicates generalization, that is, the inheritance relationship of classes. Solid lines + open diamonds represent aggregation relationships, while solid lines + solid diamonds represent combined relationships.

Another point is to pay attention to when looking at the class diagram. In fact, the idea of ​​class diagram has not been separated from the idea of ​​object-oriented. With a certain class as the center, some lines are injected and some lines are injected. The injected line indicates which classes are called by this class, and the ejected lines indicate which classes are called by this class, including generalization, association, dependency, aggregation and combination. This is similar to the description of the graph part of discrete mathematics.

1. Class (Class): represented by a three-layer rectangular box.
The first level shows the name of the class, or italics if it is an abstract class.
The second layer is fields and properties.
The third layer is the method of the class.
Note the preceding symbols, '+' means public, '-' means private, and '#' means protected.

2. Interface: It is represented by a two-layer rectangular box. The main difference from the class diagram is that there is an <<interface>> display at the top.
The first line is the interface name.
The second line is the interface method.

3. Inheritance class (extends): represented by hollow triangle + solid line.

4. Implementations: represented by hollow triangles + dotted lines

5. Association: represented by solid arrows, for example: swallows and climate

6. Aggregation: represented by a hollow diamond + solid arrow.
Aggregation : represents a weak 'owning' relationship, which reflects that A object can contain B object, but B object is not a part of A object, for example: Company and

employees Composition: represented by a solid diamond + solid arrow.
Composition: The relationship between the part and the whole, and the life cycle is the same. For example: human and hand

7. Dependency: represented by dashed arrows, for example: animal and

oxygen only wings. If a class may have an infinite number of instances, it is represented by 'n'. Associations, aggregations, and combinations have cardinalities.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326935109&siteId=291194637