A Unified Modeling Language (UML) sequence diagram illustrates the chronological sequence of messages between instances in an interaction.
A sequence diagram consists of an interaction that is represented by lifelines and the messages that they exchange over time during the interaction.
For example, you can use a sequence diagram to create your own context to understand existing behaviors and interactions in an application, and develop and generate new ones. You can use a sequence diagram to create a graphical representation of the behaviors and interactions between C/C++ classes or data types in a C/C++ application and to understand how the system works to accomplish the interactions.
In the interaction frame, you position instances in the interaction in any order from left to right, and then you position the messages between the instances in sequential order from top to bottom. Execution occurrences appear on the lifelines and show the start and finish of the flow of control.
As the following table illustrates, you can indicate several behaviors in sequence diagrams.
Behavior | Description |
---|---|
Creation | You can create an instance during the interaction by using a create message. The "created" lifeline repositions itself at the level of the create message. Otherwise, the lifeline can start at the top of the diagram to indicate that it existed before the interaction. |
Communication | You indicate messages between instances with arrows. The arrow originates from the source lifeline that sends it and ends at the target lifeline that terminates it. |
Execution | An execution occurrence shows the time during which an instance is active, either executing an operation directly or through a subordinate operation. |
Destruction | If you destroy an instance during the interaction with a destroy message or a stop node, its stem ends at the level of the stop node. Otherwise, its lifeline extends beyond the final message to indicate that it exists during the entire interaction. |