如何显示“如果”顺序图上的条件?
我想知道,如何在序列图上表示“if
”语句?
if (somethingShouldBeDone) {
// Do it
} else {
// Do something else
}
它能被代表吗?问题是......在我的代码中,检查了相当多的条件以确定各种操作。如果我要显示操作,我想明确声明操作是由特定事件引起的。
如果可能的话,创建解决方案的图像表示。
I was wondering, how can one represent "if
" statement on a sequence diagram?
if (somethingShouldBeDone) {
// Do it
} else {
// Do something else
}
Can it be represented at all? The thing is ... in my code, fair amount of conditions are checked to determine a variety of actions. If i am going to show the actions, I'd like to explicitly state that actions are caused by particular events.
If possible create an image representation of a solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
if else 条件(在 UML 术语中也称为替代)确实可以用序列图表示。这是一个链接,您可以在其中找到有关该主题的一些不错的资源
http://www.ibm.com/developerworks/rational/library/3101.html
If else condition, also called alternatives in UML terms can indeed be represented in sequence diagrams. Here is a link where you can find some nice resources on the subject
http://www.ibm.com/developerworks/rational/library/3101.html
如果您粘贴
到 https://app.zenuml.com。它将为您生成一个图表。
If you paste
onto https://app.zenuml.com. It will generate a diagram for you.
非常简单,使用 Alt 片段
让我们以 ATM 机的序列图为例。假设您希望
插入的IF卡有效,然后提示“输入密码”。 ..ELSE提示“Invalid Pin”
然后这是相同
< 的序列图图像src="https://i.sstatic.net/ySg3H.png" alt="ATM 机时序图">
希望这有帮助!
Very simple , using Alt fragment
Lets take an example of sequence diagram for an ATM machine.Let's say here you want
IF card inserted is valid then prompt "Enter Pin"....ELSE prompt "Invalid Pin"
Then here is the sequence diagram for the same
Hope this helps!
在 Visual Studio UML 序列中,这也可以被描述为片段,这里有很好的记录: https://msdn.microsoft.com/en-us/library/dd465153.aspx
In Visual Studio UML sequence this can also be described as fragments which is nicely documented here: https://msdn.microsoft.com/en-us/library/dd465153.aspx