虚怀若谷,有容乃大
我一直记不住composite和contain两种模式的uml图哪种对应哪种。今天终于想起这句话:
虚怀若谷,有容乃大
所以,空心(虚)的是contain(容)模式。。。。
看来UML标准的制定者是一个学习孔孟之道的中国人
[ 本帖最后由 key 于 3-8-2009 09:06 编辑 ]
学英语时间
下面一段摘自UML标准1.53.43.2.5 aggregation indicator
A hollow diamond is attached to the end of the path to indicate aggregation. The
diamond may not be attached to both ends of a line, but it need not be present at all.
The diamond is attached to the class that is the aggregate. The aggregation is optional,
but not suppressible.
If the diamond is filled, then it signifies the strong form of aggregation known as
composition. See Section 3.48, “Composition,” on page 3-81.
可想而知,实心菱形在标准制定者眼中是strong form的意思,而空心菱形则是非strong form。
strong的时候表示的是“只容纳一个”的composition关系,而空心则表示,随便吧,0个也行,N个也行。
以上是个人观点,请指证 实心是aggregation,而空心是composition呀,多少个可以在关系线上制定的。 sorry, 上面写反了。实心是composition,而空心是aggregation。both of them areAssociation.
Multiplicity是数字(0..1, 1, 0..* or *, 1..*)表示,和空心实心无关的。 原帖由 procoder 于 3-8-2009 13:11 发表 http://www.freeoz.org/forum/images/common/back.gif
sorry, 上面写反了。实心是composition,而空心是aggregation。both of them areAssociation.
Multiplicity是数字(0..1, 1, 0..* or *, 1..*)表示,和空心实心无关的。
multiplicity表示具体应该用什么样的数值吧?
而实心菱形强求不能超过 1 个。
比如一边写着0...*,一边画着实心菱形,那就是错的了。
下面是标准中相应的部分。
3.48 Composition
3.48.1 Semantics
Composite aggregation is a strong form of aggregation, which requires that a part
instance be included in at most one composite at a time and that the composite object
has sole responsibility for the disposition of its parts. The multiplicity of the aggregate
end may not exceed one (it is unshared). See Section 3.43, “Association End,” on
page 3-71 for further details.
回复 #5 key 的帖子
当然作为部件的对象只能为1,因为强耦合到host类去了。
页:
[1]