UML Sequence Diagram Tutorial
Sequence Diagram in UMLAccording to UML notation, a sequence diagram is a type of behavior diagram that belongs to the interaction diagrams group.
Sequence Diagram Symbols
Software Ideas Modeler offers tools for following elements of a sequence diagram:
- Execution Occurrence
- Call Message
- Reply Message
- Send Message
- Create Message
- Delete Message
- Self Message
- Recursive Message
- Destroy Occurrence
- Duration Message
- Lost Message
- Found Message
- Interaction Operand
- Opt Fragment
- Alt Fragment
- Loop Fragment
- Sd Fragment
- Par Fragment
- Neg Fragment
- Interaction Use
- State Invariant
- Duration Constraint
A lifeline is an element that represents an individual participant (object, actor, component, or process) in the interaction. It is rendered as a box with a name and vertical line. The line shows a time-ordered sequence of messages (from top to bottom).
An actor represents an external participant. An actor is rendered as a lifeline with a sticky man on the top in sequence diagrams.
An execution occurrence represents a timespan from a lifetime of a participant when an operation is executed.
Synchronous Call Message
A synchronous call sends a message from a source lifeline to a target lifeline while all other calls of the source lifeline are blocked. Messages can be associated with a class operation. Synchronous call message is displayed as a line with a solid arrow pointing from a calling lifeline to a called lifeline.
Asynchronous Call Message
An asynchronous call sends a message from a source lifeline to a target lifeline. Other calls of the source lifeline are not blocked, the next message is called immediately. Messages can be associated with a class operation. The asynchronous call message is displayed as a line with an open arrow pointing from a calling lifeline to a called lifeline.
A reply message sends a result of execution started by call message. Reply message is displayed as a dashed line with an open arrow pointing from a replying lifeline to a calling lifeline.
A create message instances a new object. A create message is displayed as a dashed line with an open arrow pointing from a creating lifeline to the head of a newly created lifeline.
A delete message performs disposing of an object. It is displayed as a line with a solid arrow pointing from a lifeline which calls a delete action to a lifeline which will be deleted. The delete messages are labeled with «destroy» stereotype. A deleted lifeline has to be ended with the X symbol (destruction occurrence).
A self message is a call message that is sent from a lifeline execution occurrence to the same occurrence.
A recursive message is a special case of a self-message. It models recursive calls.
A found message is a message with a known participant of a receiving event, but with no or unknown sending participant.
A lost message is a message with a known participant of an sending event, but with no or unknown receiving participant.
A state invariant represents a constraint that has to be true in the time of execution. It is displayed as a rounded rectangle.
A combined fragment combines interaction operands using an interaction operator. Interaction operator of the fragment can be one of these values:
- alt - abbreviation for alternatives. It defines alternative paths of execution.
- opt - abbreviation for option. It defines optional parts of execution.
- par - abbreviation for parallel.It defines parts which can be executed parallely. Operands can be called in any order, but the order of calls inside operands has to be preserved. Operands can be freely interleaved.
- critical - abbreviation for critical region. It represents atomic calls which cannot be interleaved with another calls.
- loop - defines iteration in execution.
- neg - abbreviation for negative. It defines calls for invalid or incorrect states of system.
- assert - abbreviation for assertion.
- strict - strict sequencing
- seq - weak sequencing
How to Draw a Sequence Diagram?
You can create a new sequence diagram in multiple ways:
- Click on a Plus button in the tab switch bar, navigate to UML group and click on the UML Sequence Diagram item
- Press CTRL+SHIFT+D, choose Sequence Diagram from the UML group, enter the name and click on the OK button.
- Switch to Project tab in the ribbon and click on the Sequence Diagram item in the Content gallery.
- Open Project sidebar, right-click on a project (or a folder) node, and in the Add Diagram submenu, choose UML Sequence Diagram.