How to Draw a Sequence Diagram in UML
Sequence diagrams are a type of diagram in the Unified Modeling Language (UML) that show interactions over time. This tutorial shows you how to draw them with Lucidchart.
Review this page for basic instructions, then start drawing in Lucidchart, our easy-to-use diagramming program.Try it now Sign up free
Before you begin, we suggest you also take a look at our explanation of what a sequence diagram is, and this overview of UML, especially if you are unfamiliar with these concepts. Once you understand the information, it will be easier to draw and read this type of diagram.
You can accomplish several critical tasks with a sequence diagram. A sequence diagram can:
- Show the details of a UML use case.
- Model how a complex procedure or system operates.
- Present how various tasks are transferred between objects in a sequence.
- Map out a real or hypothetical scenario that has many different components.
To accomplish these goals, you must first identify the components of your system that should be diagrammed. The first necessary set of components are the objects. The objects, sometimes called actors, are the principal players that perform tasks and send messages. For example, in an online airline reservation system, two of the objects would be the potential passenger and the website the passenger uses to book his or her flight. The other set of components you must identify are the messages the objects will send. What information is passed from one object to another? In the airline system we describe, a message from the passenger to the website would be “search flights.”
ADD SHAPES AND SYMBOLS
To start drawing sequence diagrams in Lucidchart, make sure you have the UML shape library turned on. Then scroll down and pick out shapes from the sequence diagram section of the toolbox. Start by dragging out rectangles to the top of the canvas, one for each object. Click and type to label each rectangle with the name of the object. If the object is both external and internal to the system, you may choose to use an actor symbol instead of a rectangle. You can find this symbol in the use case diagram section of the toolbox.
In Lucidchart, you can represent the flow of time in a sequence by clicking and dragging from the object shapes. Dotted lines will instantly appear, symbolizing lifelines. How long you make these lifelines depends on how many messages in the sequence you must present.
To create a message, first drag out an activation box from the shape library. The activation box is a long, thin rectangle. Drag it onto the dotted lifeline and adjust the size as necessary. Once you have an activation box in place, click on the box and drag a message arrow out from it. You can label the message by clicking and typing. To change the arrow’s direction, click on the message arrow, then the information icon, and choose “reverse direction.”
Messages can have a wide variety of types and meanings. Be sure that your messages are sending out the right information by reviewing this key for different types of messages on our sequence diagram page.
If an action is destroyed in the sequence, use a delete symbol (X) at the end of the lifeline to show that it has been destroyed.
Remember that any object can send or receive a message from any other; they do not have to be adjoining objects. Be sure that all messages correspond to the correct activation box, and remember that the diagram is finished when the last message is drawn.
REVIEW YOUR WORK
Check your work by mentally reviewing each step of the sequence, making sure that the logic is sound and that all the processes line up correctly. Allthough the lifelines don't show a specific timeframe, messages should always be listed in sequential order on a vertical basis. Once you've personally reviewed the document, share with a colleague or fellow student and ask them to look through your work as well.
If you need additional help, Lucidchart offers basic, adaptable templates for UML diagrams, including several for sequence diagrams. Check them out now!