The UML language does not prescribe how to create UML sequence diagrams. The following procedure shows a general approach to create one.
- Draw a frame (Interaction). It serves as the container for all other elements in the diagram. Create a new one, or use an existing element from your UML model that the interaction defines the behavior of.
- Specify the individual participants in the interaction by adding lifelines. Create new ones, or use existing elements from your UML model that the lifelines should represent.
- Draw messages between the lifelines, and include return messages if needed (including execution specifications).
With the above steps you have created the minimum basics of a sequence diagram.
Additionally you can add guards for conditions on messages for controlling the flow, and fragments to group sets of messages to show conditional flow in the sequence diagram.
When adding a new fragment between existing elements, for example between a lifeline and a fragment, make sure that there is enough space between these two elements in the diagram, otherwise you may not be able to add a new fragment.
An interaction use can be used to reference another interaction. State invariants are conditions that can be placed on a lifeline or freely in an interaction.
The end result may look as follows:
Example of a sequence diagram