content
- UML view
- UML diagrams
- UML class diagram relationship
There are usually four types of relationships between classes, namely Dependency, Generalization, Association, and Realization
1. Dependency
[Concept] means two The semantic connection relationship between or between multiple model elements
[Drawing method] Dotted arrow, the arrow points to the user
[Dependency diagram]
2. Generalization relationship (inheritance) (Generalization)
[Concept] Describe the general and specific relationship of a class The relationship of "is a kind of" described
[Drawing method] Solid hollow triangle arrow, the arrow points to the parent class
[Inheritance method]
1. 单继承
一个类只有一个父类
2.多继承
一个类可以有多个父类,可以从每一个父类中获得允许继承的信息
【泛化图】
3. Association
[Concept] Represents the semantic connection between the object of one thing and the object of another thing, which is simply understood as a strong dependency between two classes or a class and an interface
[Drawing method] Realization Line arrow, double arrow or no arrow
[included]
1.聚集
【概念】描述的是部分与整体关系,描述了“has a”的关系,部分离开整体可以单独存在
【绘图方式】空菱形的实线,头部指向整体
【聚集关系图】
2.组成
【概念】一种更强形式的关联,在整体中拥有管理部分特有的职责,也被称为强聚合关系,部分不能脱离整体存在
【绘图方式】实菱形的实线,头部指向整体
【组成关系图】
4. Realization
[Concept] Connect a model relationship with another model relationship, so as to explain the relationship with its implementation, which is simply understood as one class or multiple classes implement an interface
[drawing method] ] The dotted line enclosing the empty arrow, the arrow points to the interface
[Implementation relationship diagram]
The difference between generalization and implementation relationship: the
generalization relationship refers to the connection of elements in the same semantic layer, usually in the same model; the implementation relationship connects the elements in different semantic layers Elements are connected, usually within different models.