Sequence Diagram Cheat Sheet



If you need a quick reference guide for the UML notation, check one of the following great UML cheat sheets (in no particular order, though the last one if my preferred one): Visual Studio UML Reference. It includes activity, component, class, sequence and use case diagrams (menu on the left).

In order for stakeholders and project team to read the steps easier, you can optionally generate a UML sequence diagram from the scenario, to visualize the steps in sequence diagram. In this tutorial, we will try to write a simple user story and then generate a sequence diagram from it.
  1. Class Diagram Elements. Sequence Diagram Elements. UML Class Diagrams: Reference: UML class diagram. 5: Association: A. My favourite UML 'cheat sheet' is UML Distilled, by Martin Fowler.Every once in awhile, I have to draw a UML diagram. I rarely do serious designs with UML, however sometimes I do need to depict some piece of code in a diagram.
  2. Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.
  3. Process Flow Chart is a visual diagram which shows the processes and relationships between the major components in a system, and uses for this the special process flow chart symbols: special shapes to represent different types of actions and process steps, lines and arrows to represent relationships and sequence of steps.
  4. Sequence diagrams are used to represent message flow from one object to another object. Sequence diagrams are easier to maintain. Sequence diagrams are easier to generate. Sequence diagrams can be easily updated according to the changes within a system. Sequence diagram allows reverse as well as forward engineering. Drawbacks of a sequence diagram.

Writing user story scenario

  1. Create a new project with Visual Paradigm. Select Project > New from the application toolbar.
  2. In the New Project window, enter Online Shopping as project name. Click the Create Blank Project button.
  3. Open the User Story page in UeXceler. If you are not currently opening UeXceler, select UeXceler > UeXceler from the application toolbar first, and then open the User Story page.
  4. Create a general user story. Click on Add a feature that can... and enter User can add an item to shopping cart. as name.
  5. Double click on the user story to open it.
  6. Open the Scenario page.
  7. Enter the steps to accomplish this user story. Click on the first step and enter Open an item page.
  8. Press Enter and enter step 2: Select attributes (e.g. appearance, style).
  9. A quantity box will be displayed when the item user selected is still available for purchasing. Let's write an if-then-else for this. Press Enter to go to the third step. Then, press Ctrl-Space to toggle the Statement Control list.
  10. Select If from the Statement Control list.
  11. Enter out of stock.
  12. Let's say the system will display an 'out of stock' message in this situation. Press Enter to go into the if condition. Then, press Ctrl-Space again.
  13. This step is performed by the system. Let's create a System Response. Select System Response from the Statement Control list.
  14. Enter Display 'Out of stock' message..
  15. A quantity box will be displayed in the 'else' case. Now, press Enter and press Ctrl-Space to toggle the Statement Control list.
  16. Select Change to Else from the Statement Control list.
  17. Press Enter.
  18. Toggle the Statement Control list by pressing Ctrl-Space. Select System Response from the list and enter Show quantity box..
  19. Press Down to go to end if. Then, press Enter to go to step 5.
  20. The customer will then enter the quantity of item and add the item to cart. Enter Enter quantity. and Click 'Add to Cart'. as step 5 and 6, respectively.
  21. Once the item is added to cart, the system will prompt if the customer want to continue shopping. Press Enter to create a new step. Enter a system response Prompt 'Do you want to continue shopping?' as step 7.
  22. If the customer has chosen 'Yes', the system will then reopen the item page. Use the Statement Control list to add an if - has chosen 'Yes'.
  23. Press Enter to go into the if condition. Press Ctrl-Space to toggle the Statement Control list. This time, select Jump.
  24. Click on the tiny arrow button next to step 1 to represent the jumping to step 1.

Generating sequence diagram from user story

We have just completed the scenario. Let's generate a UML sequence diagram from it. Select Synchronize to Diagram > Synchronize to Sequence Diagram from the toolbar.

A UML sequence diagram is generated from the scenario in a second.

If necessary, press Ctrl-Tab to go back to the user story.

Related Links

What is UML?

Developers often use the Unified Modelling Language (UML) when designing software. UML is not a programming language, but a visual diagramming language that uses standardized models and diagrams to represent the design of the system. It was created to help software engineers and system designers better understand each other’s needs when cooperating on developing complex systems. UML originates from the mid-1990s and has been evolving and changing ever since.

What is a sequence diagram in UML and what is its purpose?

One type of UML diagram is a sequence diagram. Both developers and users depend on these because they are a very straightforward way of modeling interactions between objects in a time sequence. A sequence diagram helps create an overview of how a system works and how all the different parts interact with each other over time, carry out the required actions, and how processes are completed. Sequence diagrams can also be called event diagrams or event scenarios. A simple example of a real-world interaction that could be represented by a sequence diagram would be a user subscribing to an email service. The diagram would show the sequence of interactions between the user and the email domain over time.

Sequence diagram notations

Mermaid Sequence Diagram Cheat Sheet

In order to understand what a sequence diagram depicts, we need to become familiar with its components and structure. A sequence diagram descends from top to bottom showing a sequence of interactions and consists of a number of sequence diagram notations. So let’s take a closer look at the notations used to draw a sequence diagram.

  • Actor (object) – this is at the top of the sequence diagram and represents an object interacting with the system. Objects, or actors, represent various roles, such as users or external systems. In our email example, this would be a user registering an email address. Note that a sequence diagram can have multiple actors.
  • Lifeline – this is a vertical parallel dashed line showing the object's existence in time. Multiple lifelines can never overlap. In our email example, a lifeline could show the creation of a username and password, and logging after email verification.
  • Activation Bar – this shows the time needed for an actor to process the task and during which the object remains active. It is represented by a long thin rectangular box on the lifeline.
  • Message – the interaction between the objects (actors) in a sequence diagram happens by means of the sending of messages. These messages are represented by horizontal arrows in sequential order. Message can be sent from left to right and vice versa. The arrow indicates which object is the sender or receiver of the message. There are several different types of messages:
    • Synchronous message – represented by an arrow with a solid arrowhead. The message is first sent to the receiver, gets processed, feedback is returned to the sender, and only then can the sender continue and send another message. In our email example, this means that the user creates an account, a request for verification is sent to the email server, and then the user needs to wait for a verification email before logging in.
    • Asynchronous message – represented by an open arrowhead. This is the opposite of a synchronous message, in that the sender (message caller) does not wait for the receiver to process the message and continues its interaction immediately.
    • Return message (reply message) – represented by a dashed line with an open arrowhead – the message is sent back by the receiver to the sender. This can be skipped in a sequence diagram, as a synchronous message already contains a return message.
    • Participant creation message (create message) – sending a message can result in the creation of a new object in the sequence diagram. A create message is indicated by the word “create” over the arrow line and ends with a rectangle representing the newly created object. For example, when a user sends an online banking payment, this creates a new object in the system.
    • Participant destruction message (delete message) – this is the opposite of the create message notation. If a call message requires the destruction of an existing object, a delete message can be used in the sequence diagram. This is shown by an arrow line marked “destroy” and ending with a crossed-out “X” at the end.
    • Reflexive message (self-message) – the caller sends a message to itself. This is represented by an arrow that starts and finishes at the same lifeline for the object.
    • Found message – a message sent from an unknown source outside the sequence diagram. This is depicted by an arrow from a filled-in circle to the lifeline.
    • Lost Message – unlike a found message, this is sent to an unknown recipient outside the diagram and is shown by an arrow from a filled-in circle to the lifeline.
  • Comment – if you need to add a description to explain a particular process, you can use a comment, or note. Notes are shown as a rectangle with a folded-over corner and can be connected to an object with a dashed line.

How are sequence fragments used in complex interactions?

Sequence fragments help to deal with complex interactions between multiple objects over time. They enable you to frame part of an interaction. A fragment is defined by an interaction operand with guard values. In a sequence diagram, a fragment is shown by a rectangular with an operator in the top left corner.

The most common operators used are:

  • Alternatives (alt/else) – an operator with a choice of two or multiple operands when only one gets selected. If a guard is found, then a value is selected; if none is met, an operand with else value is chosen. In order to display the alternatives in the sequence diagram, a fragment box is divided by a dashed line into smaller boxes.
  • Options (opt) – similar to alternatives, this represents a choice, but only between two operands. The condition is either met or not met. This is also depicted by a box with an operand in the top left corner, but it is not divided by a dashed line like alternatives.
  • Loops (iterations) – the fragment can be executed multiple times until the condition is met. The loop can have Boolean values such as true or false or a lower and upper number of interactions – minimum and maximum interactions. These values are written in brackets after the loop operand in the top left corner.
  • Parallel (par) fragments run parallel in the lifeline and their order is not important.

How to create sequence diagrams in Gleek - the pro cheat sheet

You can create powerful sequence diagrams using our unique Gleek syntax. To get you going, here’s a detailed explanation of how to use the right syntax for the right notation.

CheatWeb sequence diagram cheat sheet

Let’s start by creating an actor. You can do that by just writing its name. Use any name you like and a box will be drawn to represent the actor.

Diagram

Here’s how it will look in the syntax:

And here’s how it will be drawn in the diagram:

You can draw a solid line with an arrowhead by using '-message text->' to depict a message between actors or to create a self-message (reflexive message).

Instead of a solid line, you can create a dotted line with an arrowhead with '-. message text->' to depict a message between actors or a self-message.

You can display an activation bar by adding '+' and deactivate an activation bar by adding '-'

Add a note by using ':note', e.g. “note text:note -- Actor”

Uml Sequence Diagram Cheat Sheet

Add a note over multiple actors by simply creating connections to these actors, e.g. “note over actors:note -- ActorA” and “note over actors -- ActorB”

Add a note on the left-hand side of the actor’s lifeline using ':note <-- Actor'. Add a note on the right-hand side using ':note --> Actor'

Create a multiple-line message using <br/>

Create a loop operator using '/loop'. Create other operators, such as alternative, parallel, and option by using '/alt', '/par', '/opt'

Cheat

Else (/else) is available for alternative and parallel operators.

Sequence Diagram Cheat Sheet Excel

Add s nested sequence diagram within operators by using the TAB button.

Add a dash in an operator’s name by using '-'e.g. /alt Re-join Onboarding

Sequence Diagram Cheat Sheet Template

Use two slashes '//' to create a comment.

Sequence Diagram Cheat Sheet Pdf

While a single slash '/' opens the handy Gleek template gallery ;)

Uml Sequence Diagram Cheat Sheet

That should be enough to get you started with creating complete and detailed sequence diagrams in Gleek! Remember that you can always right-click in the code area to display additional options, including shortcuts.