找回密码
 FreeOZ用户注册
查看: 1871|回复: 5
打印 上一主题 下一主题

[论坛技术] 虚怀若谷,有容乃大

[复制链接]
跳转到指定楼层
1#
发表于 3-8-2009 09:05:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?FreeOZ用户注册

x
我一直记不住composite和contain两种模式的uml图哪种对应哪种。
今天终于想起这句话:
虚怀若谷,有容乃大
所以,空心(虚)的是contain(容)模式。。。。

看来UML标准的制定者是一个学习孔孟之道的中国人

[ 本帖最后由 key 于 3-8-2009 09:06 编辑 ]
回复  

使用道具 举报

2#
 楼主| 发表于 3-8-2009 09:13:29 | 只看该作者

学英语时间

下面一段摘自UML标准1.5

3.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个也行。

以上是个人观点,请指证
回复  

使用道具 举报

3#
发表于 3-8-2009 13:08:20 | 只看该作者
实心是aggregation,而空心是composition呀,多少个可以在关系线上制定的。
回复  

使用道具 举报

4#
发表于 3-8-2009 13:11:56 | 只看该作者
sorry, 上面写反了。实心是composition,而空心是aggregation。both of them are  Association.
Multiplicity是数字(0..1, 1, 0..* or *, 1..*)表示,和空心实心无关的。
回复  

使用道具 举报

5#
 楼主| 发表于 3-8-2009 13:53:37 | 只看该作者
原帖由 procoder 于 3-8-2009 13:11 发表
sorry, 上面写反了。实心是composition,而空心是aggregation。both of them are  Association.
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.
回复  

使用道具 举报

6#
发表于 3-8-2009 20:39:14 | 只看该作者

回复 #5 key 的帖子

当然作为部件的对象只能为1,因为强耦合到host类去了。
回复  

使用道具 举报

您需要登录后才可以回帖 登录 | FreeOZ用户注册

本版积分规则

小黑屋|手机版|Archiver|FreeOZ论坛

GMT+10, 23-8-2025 23:26 , Processed in 0.016048 second(s), 22 queries , Gzip On, Redis On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表