Interactive Behaviour Is Represented in UML by Two Diagrams Known As Sequence and Collaboration

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

Sequence Diagram

Interactive behaviour is represented in UML by two


diagrams known as Sequence and Collaboration
diagram.

Sequence diagram emphasizes on time sequence of


messages and collaboration diagram emphasizes on
the structural organization of the objects that send
and receive messages.
Purpose

To capture dynamic behaviour of a system.


To describe the message flow in the system.
To describe structural organization of the objects.
To describe interaction among objects.
To model flow of control by time sequence.
Constituents of a Sequence Diagram
The main purpose of a sequence diagram is to define
event sequences that result in some desired outcome.
The focus is on the order in which messages occur.
Horizontal and vertical dimensions are used to draw an
SD.
Vertical dimension shows the time sequence of messages/
calls as they occur.
Horizontal dimension shows, left to right, the object
instances that the messages are sent to.
The basic constitutes of an SD include :

Classes and objects / role


Lifelines
Messages
Guards
Combined fragments (alternatives,
options, loops etc.)
The SD is made up of collection of
participants or objects. Participants are
system parts that interact each other
during sequence diagram.
Object:Class_Name

The participants interact with each other


by sending and receiving message

Lifeline represents the existence of an


object over a period of time.

It is represented by vertical dashed line.


Activation bar
It is also called as focus of control. It shows the
period of time during which an object is performing
an action.
The top of rectangle is aligned with start of the
action. The bottom is aligned with its completion
and can be marked by a written message
It is represented by tall thin rectangle:
1)Synchronous messages:-
* It is a message where the sender is blocked and waits until
the receiver has finished processing of message.
* It is invoked the caller waits for the receiver to return from
the message invocation.
* It is represented by solid line with full arrow.
2)Asynchronous messages:-
* It is a messages where the sender is not blocked and can
continue executing.
* It is represent by solid line with half arrow.
3)Reflexive messages
* If the object sends the message to itself then it is
called as Reflexive message.
* It is represented by solid line with loops the lifeline of
object.

4)Return messages:-
* It can be used at the end of activation bar to show
that control flow of activation returns to the participant that
pass the original message.
* It is represent by dashed line from sender to receiver.
Guards
Guard is a condition, that must be met for a message to be
sent to the object.
Guards are used throughout UML diagrams to control flow.

Place the guard element above the message line being

guarded and in front of the message name.


The notation of a guard is very simple; the format is:

[Boolean Test]
For example,

[pastDueBalance = 0]
a frame element is as the graphical boundary of a diagram. A
frame element provides a consistent place for a diagram's label,
while providing a graphical boundary for the diagram.
Option frame
The option combination fragment is used to model a sequence
that will either occur or will not occur.
An option is used to model a simple "if then" statement (i.e., if
there are fewer than five donuts on the shelf, then make two
dozen more donuts).
It only has one operand and there never can be an "else" guard.
To draw an option combination you draw a frame - text "opt" is
placed inside the frame's namebox, and in the frame's content
area the option's guard is placed towards the top left corner on
top of a lifeline.
Then the option's sequence of messages is placed in the
remainder of the frame's content area.
Gate frame
Gates can be an easy way to model the passing of information
between a sequence diagram and its context.
A gate is merely a message that is illustrated with one end
connected to the sequence diagram's frame's edge and the
other end connected to a lifeline.
Gates - entry gate (getBalance) and exit gate (balance).

You might also like