▷ 3 Sequence Diagram Examples

  • Jun 18, 2022

The sequence diagram are a diagram model found within the UML models (Unified Modeling Language), which is based on damming the sequences in the interactions of a system.

In this article you will find:

What is a sequence diagram and what is it useful for?

A sequence diagram is a type of diagram that allows to visualize how the actors in a system perform each function and the sequence in which interactions occur as the development of a systematic process unfolds.

Advertisements

What is a sequence diagram useful for? Its usefulness is basically based on allow to represent by means of a scheme the sequence in the development of each role or activity as the lapse of time elapses in the execution of the system.

this diagram

can be adapted to any system where you want to represent the order in which the functions are performed, it is ideal to represent administrative systems, production systems, even simple processes, either from a current scenario or from future events.

Advertisements

To do this, this diagram is based on a more detailed description that the use case diagrams and the class diagrams, through a graphical and logical representation of the sequences of the functions, even when they are executed simultaneously.

Essential elements in the structure of sequence diagrams

To make a sequence diagram It is essential to identify the different elements and symbols used for the development of its structure, these are:

Advertisements

  • Life line:

It is represented as a flashing line in portrait direction, at the top is attached to a rectangle with the description of the interacting object or actor.

  • Activation bar:

These bars are reflected with a rectangle narrow that overlaps the lifelines and its length represents the execution time of the activity, the longer the bar, the longer it takes to execute that role.

Advertisements

  • Message arrows:

Is a arrow pointing to life lines, to which a message is attached that is exchanged between the objects or actors, the arrow positioned at the top of the bar, reflects the start of an activity and to position itself in the bottom of bar, indicates completion of its execution.

  • Message:

Constituted by the message that isyou want to transmit between the objects or actors, indicated through horizontal arrows and in turn can be: synchronous and asynchronous.

Advertisements

The synchronous message is the one in which the one who sends the message wait for a response from the receiver and in the asynchronous messagedo not wait for an answer receiver to send the next message or to continue processing.

Also, next to the message there may be a description enclosed in “()” to represent a distinctive condition or quality in the transmission of the message.

Let's see the graphical representation of these elements and symbols in the following image:

elements and symbols of a sequence diagram

It should be noted that, in the structure of the sequence diagrams execution time is always represented verticallyand the process sequence or message is reflected from horizontal way.

Sequence Diagram Examples

1.- Example of the customer service sequence diagram

To illustrate this diagram of sequence, we will use as a reference the customer service system in a restaurant, taken into account four executors in the process, the client, the waiter, the chef and the cashier.

As seen in the diagram, each bar represents the beginning and the end of the execution of an activity made by each intervening actor.

example of a customer service sequence diagram in a restaurant

In this example, the customer asks for the food service from the waiter who, upon completion of the order, delivers it to the chef to prepare the service.

While the chef prepares the dish, simultaneously the waiter attends to the customer offering wine to drink while the chef finishes preparing the dish, whose wine is rejected by the customer, when the dish is ready the waiter serves the customer, who at the end of eating pays the bill in cash register.

In this flowchart we can highlight two different activities that are executed at the same time by two actors in the process, the waiter and the chef, while the chef prepares the dish, the waiter offers wine.

However, we can observe that messages always tend to be mostly synchronous, since in most systematic processes the continuity in the execution of a role will depend on the interaction or approval of others.

2.- Example of a sequence diagram of a money withdrawal system

sequence diagrams, although it describes the sequence of a process in detail, East does not imply that it should be overloaded with information, because too many details can become confusing to interpret.

In this case we will exemplify Using a sequence diagram the money withdrawal system provided by banks through ATMs, for this let us see the following graph of the diagram:

withdrawal sequence diagram examples

From this example we can note that a message can enter and leave the same bar in the execution of an activity, as displayed in the two bars that identify the two functions performed by the bank.

3.- Example of sequence diagram

These sequence diagrams are based on their ability to represent the order in which activities occur, even if they are executed simultaneously, as well as the exchange of messages in the execution of said functions.

Nevertheless, if a role or order in the activities changes, the sequence diagram must be updated, because it would lack the representation of the real scenario of the system process.

In this case, it is placed on the sequence diagram to represent the systematic process that occurs when requesting a library loan service.

sequence diagram examples 3

As observed, the rectangles that join the lifeline do not necessarily represent a person that it executes, because depending on the system to be represented, a role can be performed by an object, machine or any other element that acts as executor of the process.

instagram viewer