Вы находитесь на странице: 1из 20

Modeling Diagrams

Basic concepts and symbols of UML notations


(Sequence Diagram)

Sequence Diagram

Sequence Diagram

Sequence diagram: an "interaction diagram"


that models a single scenario executing in the
system

perhaps 2nd most used UML diagram (behind class


diagram)

The sequence diagram consists of objects


represented in the usual way (as named
rectangles with the name underlined),
messages represented as solid-line arrows, and
time represented as a vertical progression

Components
Objects: aStudent is a specific
instance of the Student class

Specific
Instance of an
Object

Generic (unnamed)
Generic
(unnamed)
objects

objects of class type Seminar


and Course

Objects
The objects are laid out near the top of the diagram from
left to right..
Extending downward from each object is a dashed line
called the object's lifeline.
Along the lifeline is a narrow rectangle called an
activation. The activation represents an execution of
an operation the object carries out. The length of
the rectangle signifies the activation's duration.

Components

Method call

Return value

Components

execution
lifeline

Messages
A message that goes from one object to another goes
from one object's lifeline to the other object's lifeline.
An object can also send a message to itselfthat is,
from its lifeline back to its own lifeline.

Synchronous Message
One type of message is a call. This is a request
from the object sending the message to the object
receiving the message. The request is for the
receiver to carry out one of its (the receiver's)
operations. Because the sender waits for the receiver
(that is, "synchs up" with the receiver), this message
is also referred to as synchronous.

Asynchronous Message
With this one, the sender transfers control to the
receiver and doesn't wait for the operation to
complete

Time
The diagram represents time in the vertical direction:
Time starts at the top and progresses toward the
bottom.
Thus, the sequence diagram is two-dimensional. The
left-to-right dimension is the layout of the objects,
and the top-to-bottom dimension shows the
passage of time.

Symbols in a Sequence Diagram

Example

Another Example

Model of a Soda Machine

A sequence diagram that models the best


case scenario of Buy- Soda use case

A sequence diagram that models the


sold-out scenario of Buy- Soda use case

A sequence diagram that models the incorrectchange scenario of Buy- Soda use case

A generic sequence diagram of Buy- Soda


use case

Case Study: Answering System:


One of the purpose of sequence diagram is to document use cases. We will draw
sequence diagrams for some of the use cases for Answering Machine domain.
Sequence Diagram for use case Answer Caller:
This use case begins with a caller ringing the answering machine and completes
after the call has been completed. This use case is meant to be extended by mode
specific processing.
Let's identify the activities involve to perform its responsibilities. The activities are:
The caller rings the phone line connected to the answering machine.
The Answering Machine waits for the ring count to reach the answering ring count.
The Answering Machine plays greeting.
The Answering Machine performs any mode specific processing.
If caller hangs up during the playing of the greeting, the system recognizes the
hang-up, stops the greeting and prepare for the next caller.

THE END

Вам также может понравиться