UML 序列图中的类名和对象名哪个更正确?
我只是想知道作为 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
序列图始终表示对象之间的交互。当显示对象的名称时,您可以只使用对象名称(同意,一般来说没有用),语法“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).