Sequence Diagram Tutorial
Sequence diagrams are a popular dynamic modeling solution. Dynamic modeling focuses on the the interactions occurring within the system. Sequence diagrams specifically focus on the "lifelines" of an object and how they communicate with other objects to perform a function before the lifeline ends. Make your own sequence diagram using our UML diagram tool.
Follow the link to access a customizable sequence diagram template. You can add shapes, swap out text, change colors, and much more.Demo here Sign up free
What is a Sequence Diagram
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 business people 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.
UML Sequence Diagram Examples
This sequence diagram breaks down the system of creating a new event in a calendar and announcing it. A situation like this occurs any time you use Google Calendar to schedule a work meeting or a can't-miss appointment.
Popular Sequence Diagram Uses
- Usage Scenario - A usage scenario is a diagram of how your system could potentially be used. It's a great way to make sure that you have worked through the logic of every usage scenario for the system.
- Method Logic - Just as you might use a UML sequence diagram to explore the logic of a use case, you can use it to explore the logic of any function, procedure, or complex process.
- Service Logic - If you consider a service to be a high-level method used by different clients, a sequence diagram is an ideal way to map that out.
- Sequence Diagram Visio - Any sequence diagram that you create with Visio can also be uploaded into Lucidchart. Lucidchart supports .vsd and .vdx file import and is a great Microsoft Visio alternative. Almost all of the images you see in the UML section of this site were generated using Lucidchart.
Sequence Diagram Examples
- How to draw a sequence diagrams
- How to draw a system sequence diagram
- Sequence diagram for airline reservation system
- Sequence diagram for ATM system
- Sequence diagram for banking system
- Sequence diagram for hospital management system
- Sequence diagram for hotel management system
- Sequence diagram for inventory management system
- Sequence diagram for library management system
- Sequence diagram for login system
- Sequence diagram for online shopping system
- Sequence diagram for railway reservation system
Use Lucidchart to collaborate and create UML diagrams when you start an account for free today! No plugins or download required.