Architecture & DesignSequence Diagram in UML

Sequence Diagram in UML

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

In the last article, we saw Activity diagrams, the notations to be used in Activity diagrams, their significance, and how to build an Activity diagram. We then made an Activity diagram for a specific scenario in our Courseware Management system. One of the most widely used dynamic diagrams in UML is the Sequence diagram, which is the topic of our discussion today. By the end of this article, you will know what a Sequence diagram is, what its elements are, and, you will be able to create Sequence diagrams for your system.

Basics

A Sequence diagram depicts the sequence of actions that occur in a system. The invocation of methods in each object, and the order in which the invocation occurs is captured in a Sequence diagram. This makes the Sequence diagram a very useful tool to easily represent the dynamic behavior of a system.

A Sequence diagram is two-dimensional in nature. On the horizontal axis, it shows the life of the object that it represents, while on the vertical axis, it shows the sequence of the creation or invocation of these objects.

Because it uses class name and object name references, the Sequence diagram is very useful in elaborating and detailing the dynamic design and the sequence and origin of invocation of objects. Hence, the Sequence diagram is one of the most widely used dynamic diagrams in UML.

Defining a Sequence diagram

A sequence diagram is made up of objects and messages. Objects are represented exactly how they have been represented in all UML diagrams—as rectangles with the underlined class name within the rectangle. A skeleton sequence diagram is shown in Figure 8.1. We shall discuss each of these elements in the next section:


Click here for a larger image.

Figure 8.2: a screen shot of the Poseidon tool.

The screen shot of the Poseidon tool in Figure 8.2 shows the different options to model Sequence diagrams and define interactions between objects participating in these interactions.

Case Study—Courseware Management System

From the discussion in the previous section, we are clear on the different notations that are used in Sequence diagrams. Armed with this knowledge, we will proceed to design a Sequence diagram for our Courseware Management System case study application. Because a Sequence diagram represents the dynamic flows in an application, we will aim to represent one of the flows using a Sequence diagram. In Article 3, we had defined the following use cases for the Courseware Management System:

  • View courses
  • Manage topics for a course
  • Manage course information
  • View course calendar
  • View tutors
  • Manage tutor information
  • Assign courses to tutors

For these use cases, we had modeled the classes and interfaces using the class diagram in Article 4 (parts 1 and 2). Now, we will combine the flow defined by the use cases and the classes involved in the use cases together to represent the different flows in the Courseware Management System.

As an example, we will represent the “Manage course information” flow using a Sequence diagram.

Identifying the activities and transitions for managing course information

The “Manage course information” flow contains one participant: the Course Administrator. Apart from this, there are a few entities with which the course administrator interacts in this flow—Course, Topic, and Tutor. The sequence of steps carried out in the “Manage course information” flow are:

  • A user who is a course administrator invokes the manage course functionality.
  • The manage course functionality of the course administrator invokes either the course creation or course modification functionality of a course.
  • After the course is either created or modified, the manage topic functionality of the course administrator calls the topic creation or modification functionality of a topic.
  • Finally, the user invokes the assign tutor to course functionality of the course administrator to assign a tutor to the selected course.

Now, let us model these steps into a Sequence diagram for the “Manage course information” functionality.

Sequence diagram

About the Authors

Mandar S. Chitnis, Lakshmi Ananthamurthy, and Pravin S. Tiwari are the co-founders of Novusware, Inc. They have co-authored the book Teach Yourself BEA WebLogic Server 7.0 in 21 Days (Sams Publishing, Oct. 2002), based on the recently launched WebLogic Server 7.0 by BEA Systems, Inc.

For any questions or queries regarding the article’s contents, please contact articlewriters@novusware.com.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories