UML Sequence Diagrams: CSE 403: Software Engineering, Spring 2015
UML Sequence Diagrams: CSE 403: Software Engineering, Spring 2015
courses.cs.washington.edu/courses/cse403/15sp/
Emina Torlak
[email protected]
Outline
2
intro
an overview of sequence diagrams
What is a UML sequence diagram?
4
What is a UML sequence diagram?
4
What is a UML sequence diagram?
4
Key parts of a sequence diagram
:Client :Server
checkEmail
sendUnsentEmail
newEmail
response
[newEmail] get
deleteOldEmail
5
Key parts of a sequence diagram
newEmail
response
[newEmail] get
deleteOldEmail
5
Key parts of a sequence diagram
deleteOldEmail
5
Key parts of a sequence diagram
5
Key parts of a sequence diagram
5
Sequence diagram from a use case
6
basics
sequence diagrams: syntax and semantics
Representing objects
objectname:classname
8
Representing objects
objectname:classname
8
Representing objects
objectname:classname
8
Representing messages between objects
9
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.
10
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
11
Lifetime of objects
12
Alternatives, options, and loops
[else] dispatch
13
Linking sequence diagrams
The flow is
customerInfo
ref
parse continued in
Diagram 2.
Verify Customer Credit
approved
14
Example sequence diagram
loop
AddItem
ReserveItem
Checkout
ProcessOrder
ConfirmOrder
PlaceItemInOrder
15
Forms of system control
16
Why use sequence diagrams? Why not code it?
17
Why use sequence diagrams? Why not code it?
17
Why use sequence diagrams? Why not code it?
17
Why use sequence diagrams? Why not code it?
17
Why use sequence diagrams? Why not code it?
17
Why use sequence diagrams? Why not code it?
17
study
sequence diagrams: examples
Flawed sequence diagram 1
:Dialler :CellularRadio
connect(pno)
new
:Connection
disconnected()
close()
19
Flawed sequence diagram 2
20
Online bookstore example
21
Online bookstore sequence diagram
22
Summary
23