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.
This question is related to
uml
sequence-diagram
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
If you paste
A.do() {
if (condition1) {
X.doSomething
} else if (condition2) {
Y.doSomethingElse
} else {
donotDoAnything
}
}
onto https://www.zenuml.com. It will generate a diagram for you.
Source: Stackoverflow.com