Understanding Control Flows
In this section, you will learn how to add loops and if
statements to your sequence diagrams. Messages and actors are the basis for a sequence diagram, but when you begin modeling real-world problems, it helps to have some more tools at your disposal to model the scenarios properly. This is where control flows help, as they add ways to show loops, alternative flows, and parallel executions in your diagrams. Let's start by looking at loops.
Showing loops
A loop in a sequence diagram is represented by a loop box that groups a number of messages. A loop box can have a title that can be used to indicate the nature of the loop or the condition for it. Grouped messages in a box are considered to be in a loop. The following diagram shows what a loop might look like:
This diagram has three actors that are processes: ProcessA
, ProcessB
, and ProcessC
, which...