Lecture 05 Design With Sequence
Lecture 05 Design With Sequence
diagram
Sequence
Diagram(make a phone
call)
Caller Phone Recipient
Picks up
Dial tone
Dial
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
5 : title available ()
•The vertical arrangement of
messages indicates their order. 6 : borrow title ()
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 stom e r
C a n c e lla t io n
Up d ate D atab as e
M a in t e n a n ce
O pe r a t o r
Sequence Diagram
for Deposit Money Use Case
M o n e y D e t e c t io n Ve n d in g M a c h in e M oney
C R T D is p la y
H a rd w a re C o n t ro lle r D is p e n s e r
C u stom e r
[Id le S t a t e ]
D is p la y W e lc o m e
M es s age
D e p o s it M o n e y
D is p la y A m o u n t
Se n d A mo u n t
S t a rt T im e r
P ro m p t fo r S e le c t io n
Sto p
[Id le S t a t e ] T im e r
D is p la y W e lc o m e
M es s age
System Sequence Diagram
for Make Selection Use Case
Ve n d in g M a c h in e M oney 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 ro lle r D is p e n s e r D is p e n s e r D atab as e
C u stom e r
No t e : I f
R e le a s e - I n pu t P ro m p t
B u t t o n P re s s e d s e e fo r
C a n ce lla t io n S e le c t io n
S e qu e n ce D ia g ra m
En 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
In q u ire D a t a b a s e
R e t u rn R e s p o n s e
No t e : I n s u f f icie n t
m o n e y , s e le ct io n Va lid a t e
n o t a v a ila ble
[if In v a lid S e le c t io n ]
P ro m p t fo r A n o t h e r S e le c t io n
U p d ate D atab as e
D is p e n s e P ro d u c t
D is p e n s e C a lc u la t e d
[Id le S t a t e ] Ch an g e
D is p la y W e lc o m e
M es s age
System Sequence Diagram
for Cancellation Use Case
Ve n d in g M a c h in e
N u me ric K e y p a d CRT D is p la y M o n e y D is p e n s e r
Co n tro lle r
C u s to m e r
P ro mp t
fo r
Re le a s e -In p u t S e le c tio n
Bu tto n P re s s e d
S e n d Ca n c e lla tio n S ig n a l
Re tu rn M o n e y
[Id le S ta te ]
D is p la y W e lc o me
M es s age
System Sequence
Diagram
for Update Database Use
Case W ire le s s K e y b o a rd
Ve n d in g M a c h in e
C o n t ro lle r
C R T D is p la y
P ro d u c t
D atab as e
A ll H a rd w a re
Exc e p t C R T D is p la y
M a in t e n a n c e
O pe r a t o r
Po wer On
S e n d A c t iv e S ig n a l
D is p la y P ro g ra m m in g
In fo rm a t io n
D is a b le
Se n d U p d a te Co mma n d s
U p d ate D atab as e
D is p la y U p d a t e
Co mma n d s
P o w e r O ff
T e rm in a t e U p d a t e M o d e
En a b le
[Id le S t a t e ]
D is p la y W e lc o m e In fo rm a t io n
Building a 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
12/20/24 22