You are on page 1of 22

Sequence diagram

Sequence Diagram(make a phone


call)
Caller Phone Recipient

Picks up

Dial tone

Dial

Ring notification Ring

Picks up

Hello
1. Person kicks the cat
2. Cat reports to inspector
3. Inspector reports to Policeman
4. Policeman arrests person

Slide 3
Slide 4
Slide 5
Sequence Diagrams
• Dynamic model
• Illustrate the objects that participate in a use-case
• Show the sequence of messages that pass between objects
for a particular use-case over time
• Example: order food, change tv channel
• It models a single scenario executing in the system

Slide 6
Sequence Diagrams – Object Life Spans

• Creation
Create message A

Object life starts at that point


• Activation Create
B
Symbolized by rectangular stripes
Place on the lifeline where object is
activated.
Rectangle also denotes when object is
deactivated.
• Deletion
Activation bar
X
Return
Placing an ‘X’ on lifeline Deletion
Object’s life ends at that point
Lifeline
Sequence Diagram
Us er Catalog
•Sequence diagrams demonstrate the Res ervations

behavior of objects in a use case by Message


describing the objects and the 1: look up ()

messages they pass. 2: title data ()

3: [not available] res erve title ()

•The horizontal dimension shows the


4 : title returned ()
objects participating in the interaction.
5: hold title ()

5 : title available ()
•The vertical arrangement of
messages indicates their order. 6 : borrow title ()

6 : rem ove res ervation ()

•The labels may contain the seq. # to


indicate concurrency.
Sequence Diagram for Patient appointment
Use Case

Slide 10
Sequence Diagram for Print Invoice use case

: Print Invoice : Customer : Sales Items : Invoice


Record

GetName( )

PrintCustName( )

GetAddress( )

PrintCustAddress( )

GetUnbilledItems( )

PrintLines( )

PrintTotal( )

PrintTermsConditions( )
Example: Use Case Diagram of the
Vending Machine
D e p o s it M o n e y

M a k e S e le c t io n

C u s to m e r

C a n c e lla t io n

U p d a te D a ta b a s e

M a in te n a n c e
O p e ra to r
Sequence Diagram
for Deposit Money Use Case
M o n e y D e t e c t io n V e n d in g M a c h in e M o n ey
C R T D is p la y
H a rd w a re C o n t r o lle r D is p e n s e r
C u sto m e r

[ I d le S t a t e ]
D is p la y W e lc o m e
M es s ag e
D e p o s it M o n e y

D is p la y A m o u n t

S en d A m o u n t

S t a r t T im e r

P r o m p t f o r S e le c t io n

[ I f T im e r > 3 0 s e c o n d s a n d I n v a lid o r N o S e le c t io n ]
R e tu rn M o n e y

S to p
[ I d le S t a t e ] T im e r
D is p la y W e lc o m e
M es s ag e
System Sequence Diagram
for Make Selection Use Case
V e n d in g M a c h in e M o n ey P ro d u c t P ro d u c t
N u m e ric K e y p a d C R T D is p la y
C o n t r o lle r D is p e n s e r D is p e n s e r D a ta b a s e
C u sto m e r

N o te : If
R e le a s e -I n p u t P ro m p t
B u tto n P re s se d s e e fo r
C a n c e lla tio n S e le c t io n
S e q u e n c e D ia g r a m
E n t e r S e le c t io n

D is p la y S e le c t io n

S e n d S e le c t io n

I n q u ir e D a t a b a s e

R e tu rn R e s p o n s e

N o te : I n s u ffic ie n t
m o n e y , s e le c t io n V a lid a t e
n o t a v a ila b le
[ if I n v a lid S e le c t io n ]
P r o m p t f o r A n o t h e r S e le c t io n

U p d a te D a ta b a s e

D is p e n s e P r o d u c t

D is p e n s e C a lc u la t e d
[ I d le S t a t e ] C h an g e
D is p la y W e lc o m e
M essag e
System Sequence Diagram
for Cancellation Use Case

V e n d in g M a c h in e
N u m e r ic K e y p a d C R T D is p la y M o n e y D is p e n s e r
C o n t r o lle r
C u sto m e r

P ro m p t
fo r
R e le a s e - I n p u t S e le c t io n
B u tto n P re s s e d

S e n d C a n c e lla t io n S ig n a l

R e tu rn M o n e y
[ I d le S t a t e ]
D is p la y W e lc o m e
M essage
System Sequence Diagram
for Update Database Use Case
V e n d in g M a c h in e P ro d u c t A ll H a r d w a r e
W ir e le s s K e y b o a r d C R T D is p la y
C o n t r o lle r D a ta b a s e E x c e p t C R T D is p la y
M a in te n a n c e
O pe ra to r

P o w er O n

S e n d A c t iv e S ig n a l

D is p la y P r o g r a m m in g
I n f o r m a t io n

D is a b le

S e n d U p d a te C o m m a n d s

U p d a te D a ta b a s e

D is p la y U p d a t e
C o m m an d s
P o w e r O ff

T e r m in a t e U p d a t e M o d e

E n a b le

[ I d le S t a t e ]
D is p la y W e lc o m e I n f o r m a t io n
Building a Sequence Diagram

1. Determine the context of the sequence diagram


2. Identify the participating objects
3. Set the lifeline for each object
4. Add messages
5. Add execution occurrence on each object’s
lifeline
6. Validate the sequence diagram

Slide 17
Alternate / if-else scenario in sequence
diagram

Upper or lower
part will work
at a time.
Based on the
condition.
Sequence Diagram for search book Use
Case
Multiple If-else condition

Slide 21
Thanks

06/18/21 22

You might also like