当前位置:网站首页>Summary of several relationships of UML class diagram
Summary of several relationships of UML class diagram
2022-04-23 19:16:00 【Eighteen movements of Tathagata divine palm】
stay UML In class diagram , There are several common relationships : generalization (Generalization), Realization (Realization), relation (Association), polymerization (Aggregation), Combine (Composition), rely on (Dependency)
1. generalization (Generalization)
【 Generalization relation 】: It's an inheritance relationship , It specifies how the subclass can specialize all the features and behaviors of the parent class, such as : Tiger is a kind of animal .
【 The arrow points to 】: A solid line with a triangular arrow , The arrow points to the parent class

2. Realization (Realization)
【 Realization relationship 】: It's a kind of interface relationship , A presentation class is an implementation of all the features and behaviors of an interface
【 The arrow points to 】: Dotted line with triangular arrows , The arrow points to the interface

3. relation (Association)
【 Connections 】: It's a relationship of ownership , It lets one class know the properties and methods of another class ; Such as : Teachers and students , Husband and wife
Association can be two-way , It could be one-way . A two-way association can have two arrows or no arrows , A one-way association has an arrow .
【 The code is 】: Member variables
【 Arrows and points 】: A solid line with an ordinary arrow , Point to the possessed

Above picture , Teachers and students are connected in two ways , The teacher has many students , Students may also have more than one teacher . But the relationship between students and a course is unidirectional , A student may take more than one course , Course is an abstract thing. He doesn't have students .

The picture above shows the self relevance :
4. polymerization (Aggregation)
【 Aggregate relationship 】: It's the relationship between the whole and the part . For example, the relationship between the car and the tire is the relationship between the whole and the part .
Aggregation is a kind of association , It's a strong correlation ; Association and aggregation are grammatically indistinguishable , We must examine the concrete logical relations .
【 The code is 】: Member variables
【 Arrows and points 】: A solid line with a hollow diamond , Rhombus pointing to the whole

5. Combine (Composition)
【 synthetic relation 】: It's the relationship between the whole and the part ., There is no department without a company A combination relationship is a kind of association relationship , It's a stronger relationship than an aggregate relationship , It requires that the object representing the whole in the common aggregation relationship is responsible for the life cycle of the object representing the part
【 The code is 】: Member variables
【 Arrows and points 】: A solid line with a solid diamond , Rhombus pointing to the whole

6. rely on (Dependency)
【 Dependency relationship 】: It's a relationship of use , So try not to use two-way interdependence .
【 Code representation 】: local variable 、 Method parameters or calls to static methods
【 Arrows and points 】: Dotted line with arrow , Point to the user

The order of strength and weakness of various relationships :
generalization = Realization > Combine > polymerization > relation > rely on
This picture below UML chart , It vividly shows all kinds of class diagram relationships :

版权声明
本文为[Eighteen movements of Tathagata divine palm]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231912079145.html
边栏推荐
- c#:泛型反射
- Modify the font size of hint in editext
- One stop service platform for high-level talents and development of comprehensive service platform system for talents
- 2022.04.23 (the best time for lc_714_to buy and sell stocks, including handling charges)
- js 计算时间差
- Translation of audio signal processing and coding: Preface
- mysql通过binlog恢复或回滚数据
- Accessing private members using templates
- Coordinate conversion WGS-84 to gcj-02 and gcj-02 to WGS-84
- redis优化系列(三)解决主从配置后的常见问题
猜你喜欢

On the forced conversion of C language pointer

Openharmony open source developer growth plan, looking for new open source forces that change the world!
![[报告] Microsoft :Application of deep learning methods in speech enhancement](/img/29/2d2addd826359fdb0920e06ebedd29.png)
[报告] Microsoft :Application of deep learning methods in speech enhancement

Client interns of a large factory share their experience face to face

Oracle configuration st_ geometry

RuntimeError: Providing a bool or integral fill value without setting the optional `dtype` or `out`

Sword finger offer II 116 Number of provinces - spatial complexity O (n), time complexity O (n)
![[record] typeerror: this getOptions is not a function](/img/c9/0d92891b6beec3d6085bd3da516f00.png)
[record] typeerror: this getOptions is not a function

First experience of using fluent canvas

简化路径(力扣71)
随机推荐
Disable Ctrl + Alt + Del
深度学习环境搭建步骤—gpu
Raspberry pie 18b20 temperature
std::stoi stol stoul stoll stof stod
The type initializer for ‘Gdip‘ threw an exception
MySQL Téléchargement et installation de la version Linux
Pit encountered using camera x_ When onpause, the camera is not released, resulting in a black screen when it comes back
Switching power supply design sharing and power supply design skills diagram
openlayers 5.0 当地图容器大小改变时,重新加载地图
redis优化系列(三)解决主从配置后的常见问题
Strange problems in FrameLayout view hierarchy
White screen processing method of fulter startup page
Minesweeping II of souI instance
[报告] Microsoft :Application of deep learning methods in speech enhancement
Redis optimization series (III) solve common problems after master-slave configuration
MySQL学习第五弹——事务及其操作特性详解
剑指 Offer II 116. 省份数量-空间复杂度O(n),时间复杂度O(n)
c1000k TCP 连接上限测试1
Problems caused by flutter initialroute and home
Tencent map and high logo removal method