A sequence diagram depicts the sequence of actions that occur in a system, visually capturing the dynamic behavior of a system.
A sequence diagram is two-dimensional. On the horizontal axis, it shows the life of the element that it represents, while on the vertical axis, it shows the sequence of the creation or invocation of these elements.
Because it uses class name and element name references, the sequence diagram is very useful in elaborating and detailing the dynamic design and the sequence and origin of invocation of elements. Hence, the sequence diagram is one of the most widely used dynamic diagrams in UML.
Sequence diagrams are used to:
● Requirement capturing - You can create a sequence diagram using the sequence-diagram editor, without an existing activity chart. As such, the sequence diagram is a powerful, yet intuitive tool for recording project requirements.
The sequence diagram provides a clear expression of the elements and their interactions, and helps to avoid the ambiguities, difficulties, and errors of a text-only specification.
● Logic checking - An sequence diagram can expedite the confirmation of the existence of all elements. It also enables you to examine how the elements interact within a time flow.
● Model checking - Safety and liveliness checks can be performed for a model represented by an sequence diagram. Safety checks confirm that forbidden events are excluded by the logic, for example, that an elevator door is never opened when the elevator is between floors. Liveliness checks confirm that required event constraints are specified, for example, that an elevator door closure is commanded within two seconds of the floor selection.A sequence diagram provides a view of a system or subsystem model that graphically displays the following:
Because an sequence diagram represents message flow between activities, the dominant symbols are those representing activities and messages.
● Activities in a sequence diagram are represented by parallel vertical lines (lifelines), with time flow being from the top down. Lifelines can be as long as necessary to encompass all the modeled events.
● Messages are displayed as horizontal arrows connecting the source activity lifeline to the target activity lifeline. Each activity lifeline is labeled with the names of the corresponding elements in the activity chart.