当前位置:网站首页>The difference between aggregation and composition in UML
The difference between aggregation and composition in UML
2022-07-21 04:23:00 【Mingkuai de xuanmi 61】
summary :
The combination is national ruin , Can't exist alone ;
Convergence is the bankruptcy of training institutions , The teacher runs , It doesn't have much impact on teachers ;
explain :
all the time , Yes UML Things are always ambiguous , For aggregation and composition in class diagrams , Know the difference between the two , But after a period of time, I can't tell which is which , alas , It's mainly because I didn't learn Chinese good , ha-ha !
Actually , For aggregation and composition , If you change it to English , That makes sense : Aggregation is “has-a”, Combination is “contains-a”.
Aggregation is a hollow diamond ; The combination is a solid diamond ( This is easier to understand , Solid must be more solid than hollow , ha-ha ).
Extract a passage :
The difference between aggregation and combination is : The aggregation relationship is “has-a” Relationship , The combination is “contains-a” Relationship ; The aggregation relationship means that the relationship between the whole and the part is relatively weak , And the combination is stronger ; The object that represents part of things in the aggregation relationship has nothing to do with the lifetime of the object that represents the aggregation , Once you delete an aggregate object, you don't necessarily delete the object that represents part of it . Once the combined object is deleted in the combination , At the same time, the objects representing some things are deleted .
We use simple examples to illustrate the difference between aggregation and composition .“ the country is defeated and the home lost ”, The country is destroyed , Naturally, there is no home ,“ countries ” and “ home ” Obviously, it is also a combination relationship . On the contrary , The relationship between the computer and its peripherals is aggregation , Because the relationship between them is relatively loose , The computer is gone , Peripherals can also exist independently , It can also be connected to other computers . In an aggregate relationship , Parts can exist independently of aggregation , Partial ownership can also be shared by several aggregations , For example, printers can be shared by colleagues in the office .
Java Programming ideas in Zhongyuan : Use existing classes Synthesize new classes , So this concept is called combination , If the combination is dynamic , Then call it aggregation .
边栏推荐
- UGUI——ToggleGroup
- Understanding and using unity2d custom scriptable tiles (I) -- understanding the tilebase class
- Regular expression of shell script
- About the road before and after graduation
- web框架前戏
- Web framework foreplay
- Shell循环语句详解--while、until循环
- Don't know how to learn MySQL? It's enough to finish the 50 questions of Niuke! (Part III)
- What is FTP
- Uni app - plugin [app cloud packaging] installation failed! (the app cloud packaging plug-in installation fails when the app is packaged) solution
猜你喜欢
Three swordsmen awk
Uni app - plugin [app cloud packaging] installation failed! (the app cloud packaging plug-in installation fails when the app is packaged) solution
One bite of Stream(1)
McCabe measurement method to calculate program complexity
istables防火墙
Jenkins pipeline key for remote deployment
账号和权限管理
UGUI——LayoutGroup
RAID磁盘阵列
One bite of Stream(4)
随机推荐
Jenkins pipeline key for remote deployment
"Dry goods experiment" Huawei DHCP + single arm routing experiment
One bite of Stream(4)
STM32学习(1)基本介绍
Regular expression of shell script
Some skills in cocos2dx engine
One bite of Stream(1)
Rust安装并实现一个helloworld
Jenkins Pipeline 密钥实现远程部署
使用优炫数据库时,如何查看系统是否支持某组件
Three swordsmen awk
UGUI——Graphic
One bite of Stream(3)
Ask me if there is a better way to do database migration, whole database migration, from MySQL (old) - & gt; MySQL (New)?
See "cocos2dx-3.0 as I understand it" combined with the source code - rendering process
DNS域名解析服务
The difference between rpm and yum
SAFERTOS在医疗设备中的应用
快速了解shell脚本
Understanding and use of unity2d custom scriptable tiles (III) -- start building a custom tile based on the tile class (Part 1)