Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Design Pattern & UML  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 依赖关系
coolbaby



发贴: 0
积分: 0
于 2005-03-01 08:40 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在A类的一个方法中创建了一个b的实例,并调用了b的一个方法,那么A和b的关系是不是依赖?不能算关联吧


作者 Re:依赖关系 [Re:coolbaby]
robin

超级水鬼



发贴: 128
积分: 19
于 2005-03-16 14:08 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
你的b是不是A的成员属性?如果是成员属性的话,那么它跟A就是关联关系,如果不是成员属性那么就是依赖关系。


作者 Re:依赖关系 [Re:coolbaby]
waterflower





发贴: 4
积分: 0
于 2005-03-21 11:28 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
不知道robin有没有用过together或者下面我描述的问题在任何工具中都是好一样的。
每次建立一个关联,系统会为该关联自动生成一个带Lnk前缀的名字,但是在类图中这个名字不会以属性出现在client class中,但是如果在属性中除去Lnk前缀,该关连会以属性出现在类图中。不是很理解?或者说我的问题是该如何给关联取名,什么时候应该保留Lnk前缀,什么时候应该去掉?



作者 Re:依赖关系 [Re:coolbaby]
idol





发贴: 3
积分: 0
于 2005-03-22 01:04 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
楼主你的说法很明显是依赖关系,
你是在你的操作中(method)创建了一个b的实例,并调用了b的一个方法



作者 Re:依赖关系 [Re:waterflower]
spi_cn





发贴: 194
积分: 32
于 2005-03-22 10:09 user profilesend a private message to usersend email to spi_cnsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
waterflower wrote:
不知道robin有没有用过together或者下面我描述的问题在任何工具中都是好一样的。
每次建立一个关联,系统会为该关联自动生成一个带Lnk前缀的名字,但是在类图中这个名字不会以属性出现在client class中,但是如果在属性中除去Lnk前缀,该关连会以属性出现在类图中。不是很理解?或者说我的问题是该如何给关联取名,什么时候应该保留Lnk前缀,什么时候应该去掉?

据我所知,lnk前缀应该是together所特有的,目的是将关联导航方向的设计后置。一般来说在分析阶段,往往很难确定关联的导航方向,使用带有lnk前缀的关联,将不会在类中将关联生成属性;在设计阶段,将lnk前缀去掉,并标明关联的导航方向,此时将关联生成类的属性



作者 Re:依赖关系 [Re:coolbaby]
waterflower





发贴: 4
积分: 0
于 2005-03-23 07:40 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
多谢spi_cn的解释,我好像有点明白together为什么这么干了。


作者 Re:依赖关系 [Re:coolbaby]
waterflower





发贴: 4
积分: 0
于 2005-03-23 07:42 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
其实在Window->Preferences->Modeling->Java->Associations中关联的前缀设置是lnk,你可以进行修改。
这是别人回复我的问题
By default the prefix is set to "ink" and the way of attributes displaying
is "Automatic" (We can change association link prefix and other properties
in Window->Preferences->Modeling->Java->Associations).
That means that if we create an association then the corresponding attribute
is created with the pointed prefix in code and this attribute is shown in
the model only as association link. In other words, if you need to see
associations only as accociation links in the model then you should use
prefixes in attribute namings. If you want to see also attributes in the
model then you shouldn't write prefixes in attribute namings.



作者 Re:依赖关系 [Re:coolbaby]
AKA





发贴: 7
积分: 0
于 2005-04-13 00:08 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
记得依赖关系的描述,好象是一个类是不是根据另一个类的变化而变化,以此来作为判断的准则的



flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923