UML类关系 [英] UML Class Relationships
问题描述
在确定常见的UML类关系时,我想确认我是否处于正确的轨道。例如,是以下之间的关系:
1 一个stackoverflow成员和他/她的stackoverflow用户帐户分类为组合关系或聚合关系?起初我以为这是一个协会,因为这个会员有一个帐号。然而,第二个想法,我正在考虑它的组成,因为每个部分(用户帐户)一次只属于一个整体(用户),这意味着只要我登录到stackoverflow,我必须使用这一个帐号,直到我注销。如果我使用不同的帐户登录到stackoverflow,那么它的组合再次。你同意吗?
2 一个数据库和一个人的用户帐户是一个聚合关系?我认为是因为1数据库(整体)可以存储0 ... *用户数量(部分),而另一个数据库可以存储相同的用户帐户。
最后,任何人都可以推荐一个专门使用UML设计代码的网站?
提前感谢
一个stackoverflow成员和他/她的stackoverflow用户帐户分类作为组合关系或聚合关系?
嗯,让我们看看下面的图表
- 聚合
移植可能
聚合http://drive.google.com / file / d / 0B3LutOoRJAloOTVhVHZzS3R5RTA / view
如果我想念一些手指,那么其他手可以收到 p>
- 组合
移植不可能
组合http:/ /drive.google.com/file/d/0B3LutOoRJAloNGQ5QXdvWmVySVE/view?usp=sharing
如果我想念一些手指,那么没有其他手可以接收我的缺少的手指
聚合和合成,手指(部分)的生命周期与其拥有的实体实例的生命周期绑定(如果我想念我的手,那么它的手指会被遗漏)所以,如果我删除我的Stackoverflow会员,它的UserAccount将被删除。
回到你的问题:您的UserAccount虽然已将其生命周期绑定到其Stackoverflow Member,如果遗漏,则可以分配给另一个Stackoverflow Member ??? 我不这么认为。所以,它是组合
I would like to confirm whether I am on the right track when identifying common UML class relationships. For example, is the relationship between:
1 a stackoverflow member and his/her stackoverflow user account categorized as a composition relationship or an aggregation relationship? At first I thought it was an association because this member "has a" account. However on second thought, I am thinking its composition because each "part" (user account) belongs to only one whole (user) at a time, meaning for as long as I am logged into stackoverflow, I have to use this one and only account until I log off. If I log back onto stackoverflow with a different account then its composition again. Do you agree?
2 a database and a person's user account an aggregation relationship? I think so because 1 database (the whole) can store 0...* number of user accounts (the parts) but another database can store the same user accounts.
Finally, can anyone recommend a website that specializes in designing code using UML? Thanks in advance
A stackoverflow member and his/her stackoverflow user account categorized as a composition relationship or an aggregation relationship ?
Well, Let's see the following diagram
- Aggregation
Transplant is possible
Aggregation http://drive.google.com/file/d/0B3LutOoRJAloOTVhVHZzS3R5RTA/view
If i miss some Finger, so other Hand can receive my missing Finger
- Composition
Transplant is impossible
Composition http://drive.google.com/file/d/0B3LutOoRJAloNGQ5QXdvWmVySVE/view?usp=sharing
If i miss some Finger, so no other Hand can receive my missing Finger
Both Aggregation and Composition, A Finger (The part) has its lifecycle bound to that of its owning Entity instance (if i miss my Hand, so its Finger will be missed) So, If i remove my Stackoverflow Member, its UserAccount will be removed.
Back to your question: Your UserAccount, although has its lifecycle bound to its Stackoverflow Member, if missed, can be assigned to another Stackoverflow Member ??? I do not think so. So, it is Composition
这篇关于UML类关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!