Lecture 14
Lecture 14
Recap
• When to create SSD?
• How to identify classes/instances?
• Use case descriptions
• UML notations for SSD
Contents
• Interaction diagrams
• UML notation
• Examples
Interaction Diagrams
• Show how objects interact with one another
7
Key parts of a sequence diag.
• participant: an object or entity that acts in the
sequence diagram
– sequence diagram starts with an unattached "found
message" arrow
Lifeline
name
Focus of
Control/
Activation
message
X Object
Destruction/ <<create>>
Termination <<destroy>>
Sequence Diagram (Basic)
aClass: :Scheduler
Class
Student
Register
adjustRoom checkRooms
Sequence Diagrams (Advanced)
*[Iteration Condition]
recursion
Conditional
Lifeline {transient}
Sequence Diagram(make a phone call)
Picks up
Dial tone
Dial
Picks up
Hello
Sequence Diagrams – Object Life Spans
• Creation
A
Create message
Object life starts at that point
Create
• Activation 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 diag. from use case
14
Lifetime of objects
• creation: arrow with
'new' written above it
– notice that an object
created after the start of
the scenario appears
lower than the others
• deletion: an X at bottom
of object's lifeline
– Java doesn't explicitly
delete objects; they fall
out of scope and are
garbage-collected
15
Representing objects
• squares with object type, optionally preceded
by object name and colon
– write object's name if it clarifies the diagram
– object's "life line" represented by dashed vert. line
16
Messages between objects
• message (method call) indicated by horizontal arrow
to other object
– write message name and arguments above arrow
17
Messages between objects
– dashed arrow back indicates return
– different arrowheads for normal / concurrent
(asynchronous) methods
Example
Example
Example
Summary
• SSD revision
• Loops
• Conditions in SSD