Sequence Diagram   «Prev  Next»
Lesson 4 Modeling scenarios
Objective Map an Activity Diagram to a Sequence Diagram

Modeling Sequences Scenarios

Scenarios and Sequences

A scenario describes an ordered series of events within a use case.
The goal of the sequence diagram is to assign responsibility for events to objects, thus defining the object interfaces.
To build a sequence diagram, you must match each scenario event to the objects that participate in the event as the sender and the receiver.

Tracing Interface Use Case
To draw the sequence diagram, evaluate each event in the scenario and identify the object that initiates the event. Then identify the object that is best suited to respond to the event. Draw an event arrow from the initiating object to the responding object. Label the event arrow with the event description from the scenario.

Mapping a scenario to a sequence diagram.


1) Scenario to Sequence 1 2) Scenario to Sequence 2 3) Scenario to Sequence 3 4) Scenario to Sequence 4 5) Scenario to Sequence 5 6) Scenario to Sequence 6 7) Scenario to Sequence 7 8) Scenario to Sequence 8 9) Scenario to Sequence 9 10) Scenario to Sequence 10 11) Scenario to Sequence 11 12) Scenario to Sequence 12 13) Scenario to Sequence 13 14) Scenario to Sequence 14 15) Scenario to Sequence 15 16) Scenario to Sequence 16
  1. Use one scenario as your source for the events and their order. Here we will use an activity diagram of the Choose Show use case to isolate one scenario. The red lines and activities identify one scenario (one logical path) in the activity diagram.
  2. For the first event, choose the class from the class diagram that describes the object initiating the event. The initiating object may be in a class that represents an actor, the system itself, or one of the problem domain resources. In this case the initiating object is a Customer.
  3. Draw the object at the top of the diagram.
  4. Draw a timeline vertically from the object downward.
  5. For each event, choose a class from the class diagram that describes the object best suited to receive and respond to the event.
  6. Draw the object at the top of the diagram.
  7. Draw a timeline vertically from the object downward.
  8. Draw a horizontal arrow from the sending object's timeline to the receiving object's timeline.
  9. Label the event line with the description of the event from the scenario.
  10. If the event requires a response, then add an event arrow from the receiving object's timeline back to the sending object's timeline.
  11. Label the return with the information that is returned. If the event simply returns control it is common to simply label the event return .
  12. Repeat this procedure for each event until all events in the scenario have been applied to the sequence diagram.

Drawing Sequence Diagram
As you place events on the sequence diagram, take care to position them on the timeline from top to bottom in the order that they occur. Quite often, once the events are placed on a timeline, you will notice inefficiencies that may be remedied simply by changing the order of the events. To change the order of events, move the events up or down the timeline.