UML Tutorial: Sequence Diagrams

Categories:

Recommended

A sequence diagram or system sequence diagram (SSD) shows process interactions arranged in time sequence in the field of software engineering. It depicts the processes involved and the sequence of messages exchanged between the processes needed to carry out the functionality. Sequence diagrams are typically associated with use case realizations in the 4+1 architectural view model of the system under development. Sequence diagrams are sometimes called event diagrams or event scenarios.

For a particular scenario of a use case, the diagrams show the events that external actors generate, their order, and possible inter-system events.[1] All systems are treated as a black box; the diagram places emphasis on events that cross the system boundary from actors to systems. A system sequence diagram should be done for the main success scenario of the use case, and frequent or complex alternative scenarios.

In this column we will be discussing UML Sequence diagrams. Sequence diagrams contain the same information as Collaboration diagrams, but emphasize the sequence of the messages instead of the relationships between the objects.

A sequence diagram shows, as parallel vertical lines (lifelines), different processes or objects that live simultaneously, and, as horizontal arrows, the messages exchanged between them, in the order in which they occur. This allows the specification of simple runtime scenarios in a graphical manner.

A system sequence diagram should specify and show the following:

External actors
Messages (methods) invoked by these actors
Return values (if any) associated with previous messages
Indication of any loops or iteration area

Professionals, in developing a project, often use system sequence diagrams to illustrate how certain tasks are done between users and the system. These tasks may include repetitive, simple, or complex tasks. The purpose is to illustrate the use case in a visual format. In order to construct a system sequence diagram, you need to be familiar with the unified modeling language (UML). These models show the logic behind the actors (people who affect the system) and the system in performing the task. Reading a sequence diagram begins at the top with the actor(s) or the system(s) (which is located at the top of the page). Under each actor or system there are long dotted lines called lifelines, which are attached to them. Actions are performed with lines that extend between these lifelines. When an action line is connected to a lifeline it shows the interaction between the actor or system. Messages will often appear at the top or bottom of a system sequence diagram to illustrate the action in detail. For example, the actor could request to log in, this would be represented by login (username, password). After each action is performed, the response or next action is located under the previous one. As you read down the lines you will see in detail how certain actions are performed in the provided model, and in what order.

Conclusion

It is clear that sequence charts have a number of very powerful advantages. They clearly depict the sequence of events, show when objects are created and destroyed, are excellent at depicting concurrent operations, and are invaluable for hunting down race conditions. However, with all their advantages, they are not perfect tools. They take up a lot of space, and do not present the interrelationships between the collaborating objects very well. With all the power that sequence diagrams have to offer, I still find the density and elegance of collaboration diagrams more pleasing. Therefore, as a matter of personal taste, I use sequence diagrams only when their particular powers are required. In subsequent columns we will be investigating, among other things, the UML notation for finite state machines, Activity diagrams, Domain models, Use Cases, Packages, and Components.

Category:
Tag:

Attribution

Robert C. Martin. UML Tutorial: Sequence Diagrams.https://condor.depaul.edu/dmumaugh/readings/handouts/SE430/UMLSequenceDiagrams.pdf

VP Flipbook Maker

This flipbook is created by the Visual Paradigm flipbook Tool, you can also develop a book like this. Visual Paradigm flipbook maker tool focuses on providing page-turning effects that stay clear and fast on all desktop computers and mobile devices, try it now!