获取 UML 图中的方法和类关系
这个问题一遍又一遍地困扰着我,但我找不到明确的答案。对于大多数人来说,回答这个问题应该很简单,所以请您帮我正确使用 UML 好吗?
如果我有类 A
、B
和 C
。 B
的实例是 A
的成员,C
的实例是 B
的成员。现在B
提供了一个方法,该方法返回其类C
的成员,并且A
在他的一个方法中调用该方法并对其执行一些操作。在 UML 中,A
和 C
之间现在是否存在依赖关系
?或者这种关系是否如此明显以至于可以省略(否则 UML 图很快就会变得难以忽视)?为了说明问题,请简要描述所描述的情况:
This question is bugging me over and over again and I cannot find a clear answer to it. For most people this should be trivial to answer, so please, could you please help me using UML correctly?
If I have classes A
, B
and C
. An instance of B
is a member of A
and an instance of C
is a member of B
. Now B
offers a method, which returns its member of Class C
and A
calls this method in one of his methods and does some actions on it. In UML, is there now a dependency
between A
and C
? Or is it so obvious that the relationship can be ommitted (otherwise the UML diagram could become hard to overlook in no time)? To illustrate the problem, a short sketch of the described situation:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不需要从 A 到 C 的链路。
从 A 到 B 和 B 到 C 的箭头显示可见性(或导航),使得 C 对 B 可见,B 本身对 A 可见,这意味着存在从 A 到 C 的假定路径,并且不需要显式线路被绘制。另外,就像你说的,遵循这种模式会很快创建一个笨拙的图表。
The link from A to C is not needed.
The arrows from A to B and B to C show the visibility (or navigation) such that C is visible to B which is itself visible to A, which means that there is an assumed path from A to C and an explicit line does not need to be drawn. Plus, like you say, following that pattern would quickly create an unwieldy diagram.