UML Sequence Diagram – How to Show an If Statement

sequence-diagramstandardsuml

I went on an interview last year and was shown a sequence diagram and was asked to describe the the sequence. There were 2 things in the diagram I had never seen before. I asked what one of them was and was told that's how an if statement is shown in a sequence diagram. The other was an arrow going back to the actor that originated the arrow, I assumed that was a loop.

  1. Is there a standard way to show a conditional sequence?
  2. How often is a conditional sequence used in UML sequence diagrams?

Best Answer

1.Is there a standard way to show a conditional sequence?

Yes. You can use the If else condition, also called alternatives in UML terms.

2.How often is a conditional sequence used in UML sequence diagrams? Every time there is the need to explain the choice between two or more message sequences.

You can read more about it here