Lecture 08 Sequence Diagram
Lecture 08 Sequence Diagram
Engineering
Lecture # 07
2
Outline
• Examples
Mehak Fatima 3
intro
an overview of sequence diagrams
Mehak Fatima
4
What is a U M L sequence diagram?
Mehak Fatima
5
Key parts of a sequence
diagram
• Participant: an object or an
:Client :Server
entity; the sequence diagram
actor checkEmai
• sequence diagram starts with an l sendUnsentEma
il
unattached "found message"
arrow newEmail
response
[newEmail]
get
deleteOldEmail
Mehak Fatima
6
Key parts of a sequence
diagram
• Participant: an object or an
:Client :Server
entity; the sequence diagram
actor checkEmai
• sequence diagram starts with an l sendUnsentEma
il
unattached "found message"
arrow newEmail
respons
• Message: communication between e
[newEmail] get
objects
deleteOldEmail
Mehak Fatima
7
Key parts of a sequence
diagram
• Participant: an object or an
:Client :Server
entity; the sequence diagram
actor checkEmai
• sequence diagram starts with an l sendUnsentEma
il
unattached "found message"
• Message: communication between
arrow newEmail
objects
respons
• Axes in a sequence diagram: e
[newEmail] get
• horizontal: which participant is
acting deleteOldEmail
Mehak Fatima
8
Key parts of a sequence
diagram
• Participant: an object or an
:Client :Server
entity; the sequence diagram
actor checkEmai
• sequence diagram starts with an l sendUnsentEma
il
unattached "found message"
• Message: communication between
arrow newEmail
objects
respons
• Axes in a sequence diagram: e
[newEmail] get
• horizontal: which participant is
acting deleteOldEmail
Mehak Fatima
9
Sequence diagram from a use
case
Mehak Fatima
10
basics
sequence diagrams: syntax and semantics
Mehak Fatima
11
Representing objects
objectname:classna
me
• An object: a box with an Named Anonymous
underlined label that specifies the object object
object type, and optionally the
object name. Smith:Patient :Patient Smith
• Write the object's name if it clarifies
the diagram. Object of unknown
class
Mehak Fatima
12
Representing objects
objectname:classna
me
• An object: a box with an Named Anonymous
underlined label that specifies the object object
object type, and optionally the
object name. Smith:Patient :Patient Smith
• Write the object's name if it clarifies
the diagram. Object of unknown
• An object's "life line" is represented class
by a dashed vertical line. Lifelin
• Represents the life span of the object e
during the scenario being modeled.
Mehak Fatima
13
Representing messages between
objects
Mehak Fatima
14
Different types of messages
:Controller
• Type of arrow indicates types of
messages:
• Synchronous message: solid arrow with a solid
head.
• Asynchronous message: solid arrow with a stick
head.
• Return message: dashed arrow with stick head.
Mehak Fatima
15
Indicating method execution
:Controller
• Activation: thick box over object's life line,
drawn when an object's method is on the stack
• Either that object is running its code,
or it is on the stack waiting for another object's
method to finish
• Nest activations to indicate an object calling
itself. :Controller
Mehak Fatima
16
Lifetime of objects
Mehak Fatima
17
Alternatives, options, and loops
[else dispatc
] h
Mehak Fatima
18
Linking sequence diagrams
The flow is
customerInf
re
pars continued in
o e
f Diagram 2.
Verify Customer Credit
approve
d
Mehak Fatima
19
W h y use sequence diagrams? W h y not code
it?
Mehak Fatima
20
study
sequence diagrams: example
Mehak Fatima
21
Online bookstore example
Mehak Fatima
22
Online bookstore sequence diagram
Mehak Fatima
23
Summary
Mehak Fatima
24