Visual Modeling with Rational Rose 2002 and UML (3rd Edition)

I l @ ve RuBoard

A sequence diagram shows object interactions arranged in time sequence. It depicts the objects and classes involved in the scenario and the sequence of messages exchanged between the objects needed to carry out the functionality of the scenario. Sequence diagrams typically are associated with use case realizations in the Logical View of the system under development.

In the UML, an object in a sequence diagram is drawn as a rectangle containing the name of the object, underlined . An object can be named in one of three ways: the object name, the object name and its class, or just the class name (anonymous object). The three ways of naming an object are shown in Figure 5-5.

Figure 5-5. Naming Objects in a Sequence Diagram

Object names can be specific (e.g., Algebra 101, Section 1) or they can be general (e.g., a course offering). Often, an anonymous object (class name only) may be used to represent any object in the class.

Each object also has its timeline represented by a dashed line below the object. Messages between objects are represented by arrows that point from the client (sender of the message) to the supplier (receiver of the message).

The UML notation for objects and messages in a sequence diagram is shown in Figure 5-6.

CREATING A SEQUENCE DIAGRAM IN RATIONAL ROSE

  1. Right-click to select the use case realization in the Logical View of the browser and make the shortcut menu visible.

  2. Select the New:Sequence Diagram menu choice. An unnamed sequence diagram is added to the browser.

  3. With the new sequence diagram selected, enter the name of the sequence diagram.

Figure 5-6. UML Notation for Objects and Messages in a Sequence Diagram

The browser view of a sequence diagram is shown in Figure 5-7.

CREATING OBJECTS AND MESSAGES IN SEQUENCE DIAGRAMS IN RATIONAL ROSE

  1. Double-click on the sequence diagram in the browser to open the diagram.

  2. Click to select the actor in the browser.

  3. Drag the actor onto the sequence diagram.

  4. Click to select the Object icon from the toolbar.

  5. Click on the sequence diagram window to place the object.

  6. While the object is still selected, enter the name of the object.

  7. Repeat the preceding steps for each object and actor in the scenario.

  8. Click to select the Object Message icon from the toolbar.

  9. Click on the actor or object sending the message and drag the message line to the actor or object receiving the message.

  10. While the message line is still selected, enter the name of the message.

  11. Repeat steps 7 through 9 for each message in the scenario.

Figure 5-7. Browser View of a Sequence Diagram

The sequence diagram for the Create a Course scenario is shown in Figure 5-8.

ASSIGNING OBJECTS IN A SEQUENCE DIAGRAM TO CLASSES IN RATIONAL ROSE

  1. Click to select the class in the browser.

  2. Drag the class onto the object in the sequence diagram. Rose will add the class name preceded by a colon (:) to the object name. If the object is unnamed, the name is set to :className. If the stereotype display for a class is set to icon, and if an icon exists, then the icon will be used in the sequence diagram.

Figure 5-8. Sequence Diagram

A sequence diagram with the object "a course" assigned to the Course class is shown in Figure 5-9.

Figure 5-9. Sequence Diagram with an Object Assigned to a Class

I l @ ve RuBoard

Категории