如何在 UML 序列图中显示实例化?
如何显示 Web 服务器实例化视图并重新获得流的控制权?也许我没有使用正确的图表类型? 非常感谢!
How do I show that the WebServer instantiates a View and gets back control of the flow? Maybe I'm not using the right type of diagram?
Thanks a bunch!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Ruben 的答案中的图表是正确的,但缺少一般的 UML 答案。当“创建”线(在本例中为虚线)连接到所创建生命线的框/标签/顶部时,它会创建另一条生命线。从示例:WebServer 在其操作中创建视图,视图完成的操作创建小部件。
这里还有几个图表。
UML 2.2 规范(上层结构)在页面上有一个示例474,图 14.11 是他们的规范语法/符号参考。第 495 页的符号部分指出“对象创建消息有一条带空心箭头的虚线。”这在 UML 中得到了进一步定义,因为消息类型是一个名为 MessageSort 的枚举。一个值是:
The diagram from Ruben's answer is correct, but general UML answer is missing. It creates the other lifeline when the "create" line (dashed in this case) connects to the box/label/top of the created life line. From example: WebServer in it's action creates a View and the action done by the view creates the Widget.
There are also several diagrams here.
The UML 2.2 specifications (superstructure) has an example on page 474, Figure 14.11 is their canonical syntax/notation reference. And on page 495 in the notation section it states "Object creation Message has a dashed line with an open arrow." This is further defined in the UML as the message type is an enumeration called MessageSort. One value is:
正确,使用“创建”消息来显示由目标生命线表示的对象的实例化。以下是 VS 2010 Ultimate 文档中主题的示例:
UML 序列图:参考,位于 http://msdn.microsoft.com/en-us/library/dd409377%28VS.100%29.aspx< /a>
Correct, use a "create" message to show instantiation of the object represented by the target lifeline. Here's an example from a topic in the VS 2010 Ultimate docs:
UML Sequence Diagrams: Reference at http://msdn.microsoft.com/en-us/library/dd409377%28VS.100%29.aspx
是的,您可以使用
create
消息。有时这取决于您使用的工具。无论如何,您只需要一个箭头来显示指向正在创建的对象的文本create
。Yes you can, using a
create
message. Sometime it depends on the tool you are using. Anyway you just need an arrow that show the textcreate
pointing to the object being created.