You are on page 1of 27

STID 3024

SYSTEMS ANALYSIS
AND
DESIGN

Sequence Diagrams and


Communication
Diagrams

Week 6 7

Learning Objective

To model object collaboration using an interaction


sequence diagrams
To Identify and transform the use case
specification into sequence diagrams using UML
notation
To model object collaboration using
communication diagram
To transform sequence diagram into
communication diagram
To cross-check between interaction diagrams and
a class diagram

Object Messaging
Objects communicate by sending
messages
Message is an information sent to
objects to execute one of its behaviour.
Sending a message selectDrink() to
DrinkMgr

CustomerPanel

DrinkMgr
selectDrink()

Interaction Diagram

Interaction diagram is used to describe the


object interaction.
It is used to determine the most appropriate
scheme of messaging between objects in
order to support a particular user requirements.
4 types of interaction diagram:

sequence diagram
communication diagram (collaboration diagram)
Interaction overview diagram
Timing diagram

Sequence Diagrams

The sequence diagram shows the interactions


among objects that participate in a use case and
the message that pass between them over time
for one use case.
It is a dynamic model that shown in a time
sequence.
Depicts the sequential of actions that occur in
an operation of the system or in the use case.
Show the interactions between objects of classes
in a time-ordered manner.
Typically used to represent the detailed interaction
among object of the classes, not among the
classes themselves.

Sequence Diagrams.
Each use case has a number of flows
(basic flow, exceptional flows and
alternative flows)
Each sequence diagram represents of the
flows through use case diagram.

Elements of Sequence
Diagrams

Actor
- A person/system that participates in a
sequence by sending or receiving
message.
- place across the top of the diagram
using actor symbol (refer use-case
diagram)

Actor

Elements of Sequence
Diagrams

Object
- Place across the top of the diagram using
object symbol. Participates in a sequence by
sending or receiving message.

Object

Elements of Sequence
Diagrams

Message

- Objects communicate by sending messages


- Message is an information sent to objects to
execute one of its behaviour.
- using solid lines connecting two objects.

CustomerPanel

DrinkMgr
Select drink

Elements of Sequence
Diagrams

lifeline
- using dotted line runs vertically below
each actor and object to denote the life
line of the actor/object over time.
I
I
I
I
I

Elements of Sequence
Diagrams

Focus of control/ execution


occurrence/ activation
- is a long, narrow rectangle placed a
top a lifeline.
- indicates times during an activation
when processing is taking place
within the object.
- the length of the rectangle signifies
the activations duration.

Elements of Sequence
Diagrams

Reflexive message/ self delegation


- object can send message to itself

Object

message

Example of Sequence
diagram
Login Panel

StudentInfo

Login Manager

: Student

object

insert ID and Password

message
press Submit Button

Focus of
control

checkIDPassword

getPassword

A1: Press
Cancel
verifyPassword
DisplaySuccessfulMsg

E1: Invalid
IDPassword

lifeline

Reflexive
message

Steps for building Sequence


Diagram
Set the context of sequence diagram
- define which use case/ a scenario of a use
case (normal flow, alternative flow and
exceptional flow)
Identify which actor will involve
Identify which objects will participate
Set the lifeline for each object
Layout the message from the top to the
bottom of the diagram based on the order in
which they are sent.

Steps for building


Sequence Diagram
Add the focus of control to each objects
life
Validate the sequence diagram

Communication Diagrams

Hold the same information as sequence diagrams


Show links between objects that participate in
the collaboration
The sequence diagram and communication
diagram both show interaction, but the sequence
diagram focuses on the time ordering of the
messages being passed and the communication
diagram emphasizes the flow of messages
through a set of objects.

Elements of communication
Diagrams

Actor
- A person/system that derives benefit
from and is external to the system
- participate in sequence by sending
and/or receiving messages

Actor

Elements of

Communication Diagrams

Object
-Participate in a sequence by sending
and/or receiving messages
anObject

Elements of

Communication Diagrams

Association
-Shows

an association between actors or


between actors and objects
-Messages

are sent over associations

Elements of
Communication Diagrams

Message
-Conveys

information from one object to


another one
-Direction

is shown using an arrowhead

-Sequence

number

is shown by a sequence
1:message

Example of Sequence
diagram
Scenario : Joe, a bank customer withdrawing
$20 from the ATM
The process begins when Joe inserts his card into the
card reader. The card reader reads the number on Joes
card, then tells the ATM screen to initialize itself. The
ATM prompts Joe for his PIN. Joe enters his PIN and
the ATM opens his account. Joes PIN is validated, and
the ATM prompts him for a transaction. Joe selects
Withdraw. The ATM prompts Joe for the withdrawal
amount. Joe enters $20. The ATM verifies that Joes
account has sufficient funds, and subtracts $20 from
the account. The ATM dispenses $20 and ejects Joes
card.

Example of Sequence
diagram
Joe : Cus tom er

Card Reader

ATM Screen

Joe's Account

1. Accept Card
2. Read Card No.

3. Initialize Screen

4. Prom pt PIN

5. Enter PIN

6. Open Account
7. Verify PIN

Complete Sequence diagram

Example of Communication
Diagrams
2: Read Card No.

1: Accept card

object

Card
Reader
Joe : Customer

5: Enter PIN
3: Initialize Screen

4: Prom pt for PIN

message

ATM
Screen

Complete Collaboration diagram

6: Open Account
7: Verify PIN

association

Joe's
Account

The sequence diagram can be transformed into a


collaboration diagram using a CASE tool.
Sequence diagram

It is organized in
chronological
sequence
Emphasize on the
time ordering of
the messages
being passed

VS Communication
diagram

Not in
chronological
sequence
Emphasize the
flow of messages
through a set of
objects

Steps for Building

Communication Diagrams
Set the context define which use case
Identify which objects (actors) and the

associations between the objects


participate in the collaboration.
Lay out the collaboration diagram by
placing objects and actors based on the
associations.
Add message to the associations between
the objects.
Validate the collaboration diagram

Cross-check between interaction diagrams and a


class diagram

From one sequence


diagram to a class
diagram

You might also like