UML 序列图中的类名和对象名哪个更正确?

发布于 2024-08-27 15:51:33 字数 501 浏览 3 评论 0原文

我只是想知道作为 UML 序列图中对象的标签而不是对象名称(在我看来与类名称无关并且信息量较少)提供类名称是否更正确。另一件事,在返回信息而不是列出所有对象名称时,只编写集合是一个更好的解决方案;

带有对象名称的图表:替代文本 http://www.freeimagehosting.net/uploads/934c6a3e87.png :

带有类名的图表 替代文本 http://www.freeimagehosting.net/uploads/a44244eb7c.png

作为从第二张图可以清楚地看出,它比第一张图的信息量要大得多,而且我认为它更实用。

I was just wondering if it is more correctly to as a label of objects in UML sequence diagram instead of object name (which is irrelevant in my opinion and less informative than class name) provide class name. Another thing, while returning information instead of listing all objects names would it be a better solution to just write collection;

Diagram with object names:alt text http://www.freeimagehosting.net/uploads/934c6a3e87.png

Diagram with class names:
alt text http://www.freeimagehosting.net/uploads/a44244eb7c.png

As it's clearly visible from the second diagram that it is much more informative than the first one, and I think it is more practical.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

话少情深 2024-09-03 15:51:33

序列图始终表示对象之间的交互。当显示对象的名称时,您可以只使用对象名称(同意,一般来说没有用),语法“object:class”(当您建模特定场景时很重要,其中对象的名称与理解相关)场景)或只是“:class”(这里使用匿名对象来指示该场景适用于该类的所有对象)。

Sequence diagrams always represent interactions between objects. When showing the name of the object you can just use the object name (agreed, not useful in general), the syntax "object:class" (important when you are modeling a specific scenarion in which the name of the object is relevant to understand the scenario) or just " :class" (here you are using an anonymous object to indicate that the scenario applies to all objects of the class).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文