What is a Sequence Diagram in UML?
Sequence diagrams are simple subsets of interaction diagrams. They map out sequential events in an engineering or business process in order to streamline activities.
To create a sequence diagram for school or work, just click the buttons below. Lucidchart is free, flexible, and easy to use. Plus, you can collaborate with any number of teammates!Try it now Sign up free
What is a Sequence Diagram in UML?
To understand what a sequence diagram is, it's important to know the role of UML. UML, or the Unified Modeling Language, is a modeling toolkit that guides the creation and notation of many types of diagrams, including behavior diagrams, interaction diagrams, and structure diagrams. Sequence diagrams are a kind of interaction diagram, because they describe how—and in what order—a group of objects works together. These diagrams are used by software developers and businesspeople alike to understand requirements for a new system or to document an existing process. Sequence diagrams are sometimes known as event diagrams or event scenarios.
Remember that there are two types of sequence diagrams: UML ones and code-based ones. The latter are sourced from programming code and will not be covered in this guide.
Sequence Diagram Applications
Sequence diagrams can be useful reference diagrams for businesses and other organizations. Try drawing a sequence diagram to:
- Represent the details of a UML use case.
- Model the logic of a sophisticated procedure, function, or operation.
- See how tasks are moved between objects or components of a process.
- Plan and understand the detailed functionality of an existing or future scenario.
SEQUENCE DIAGRAM COMPONENTS
To understand what a sequence diagram is, you should be familiar with its components. Sequence diagrams are made up of the following elements:
- Object - this box shape represents a class, or object, in UML. They demonstrate how an object will behave in the context of the system. Class attributes should not be listed in this shape.
- Activation boxes - symbolized by a rectangle shape, an activation box represents the time needed for an object to complete a task. The longer the task will take, the longer the activation box becomes.
- Actors - represented by a stick figure, actors are entities that are both interactive with and external to the system.
- Package - also known as a frame, this is a rectangle shape that is used in UML 2.0 notation to contain interactive elements of the diagram. The shape has a small inner rectangle for labeling the diagram.
- Lifeline - a dashed vertical line that represents the passage of time as it extends downward. Along with time, they represent the sequential events that occur to an object during the charted process. Lifelines may begin with a labeled rectangle shape or an actor symbol.
- Option loops - a rectangle shape with a smaller label within it. This symbol is used to model "if then" scenarios, i.e., a circumstance that will only occur under certain conditions.
- Alternatives - used to symbolize a choice (that is usually mutually exclusive) between two or more message sequences. To represent alternatives, use the labeled rectangle shape with a dashed line inside.
- Messages - packets of information that are transmitted between objects. They may reflect the start and execution of an operation, or the sending and reception of a signal.
- Synchronous messages - represented by a solid line with a solid arrowhead. This symbol is used when a sender must wait for a response to a message before it continues. The diagram should show both the call and the reply.
- Asynchronous messages - represented by a solid line with a lined arrowhead. Asynchronous messages are those that don't require a response before the sender continues. Only the call should be included in the diagram.
- Asynchronous return messages - represented by a dashed line with a lined arrowhead.
- Create messages - represented by a dashed line with a lined arrowhead. These messages are sent to lifelines in order to create themselves.
- Reply messages - represented by a dashed line with a lined arrowhead, these messages are replies to calls.
- Delete messages - represented by a solid line with a solid arrowhead, followed by an X symbol. This messages indicates the destruction of an object and is placed in its path on the lifeline.