Beruflich Dokumente
Kultur Dokumente
Sequence Diagram
Slide1
Interaction Diagrams
Interaction Diagrams
Sequence diagrams
Collaboration diagrams
demonstrate how objects are statically connected.
Interaction Diagrams
Sequence Diagram
Slide5
Sequence Diagram
X-Axis (objects)
member:
LibraryMember
:Book
Copy
book:Book
borrow(book)
Y-Axis (time)
ok = mayBorrow()
Message
[ok] borrow(member)
Life
Line
setTaken(member)
Object
Focus of
control
Condition
Slide6
AN OBJECT
anObject:aClass
A LIFELINE
A FOCUS OF CONTROL
A MESSAGE
OBJECT DESTRUCTION
aMessage()
x
Slide7
Sequence Diagram
Two major components
Active objects
Communications between these active
objects
Messages sent between the active objects
Slide8
Sequence Diagram
Active objects
Any objects that play a role in the
system
Participate by sending and/or receiving
messages
Placed across the top of the diagram
Can be:
An actor (from the use case diagram)
Object/class (from the class diagram) within the
system
Slide9
Active Objects
Object
Can be any object or class that is
valid within the system
Object naming
myBirthdy
:Date
Syntax
[instanceName][:className]
1.
2.
3.
Active Objects
Actor
A person or system that derives
benefit from and is external to the
system
Participates in a sequence by sending
and/or receiving messages
Slide11
Sequence Diagram
Slide12
Communications
between Active Objects
Messages
Used to illustrate communication
between different active objects of a
sequence diagram
Used when an object needs
to activate a process of a different object
to give information to another object
Slide13
Messages
A message is represented by an arrow
between the life lines of two objects.
Self calls are allowed
Slide14
Types of Messages
Slide15
Synchronous Messages
:B
doYouUnderstand()
Caller
Blocked
yes
return
(optional)
Slide16
Asynchronous Messages
Examples
Notification of somebody or something
Messages that post progress
information
Slide17
Return Values
Slide18
Sequence Diagram
X-Axis (objects)
member:
LibraryMember
:Book
Copy
book:Book
borrow(book)
Y-Axis (time)
ok = mayBorrow()
Message
[ok] borrow(member)
Life
Line
setTaken(member)
Object
Focus of
control
Condition
Slide19
Other Elements
of Sequence Diagram
Lifeline
Focus of control (activation box or
execution occurrence)
Control information
Condition, repetition
Slide20
Sequence Diagram
Lifeline
Denotes the life of actors/objects over
time during a sequence
Represented by a vertical line below
each actor and object (normally dashed
line)
Sequence Diagram
Sequence Diagram
X-Axis (objects)
member:
LibraryMember
:Book
Copy
book:Book
borrow(book)
Y-Axis (time)
ok = mayBorrow()
Message
[ok] borrow(member)
Life
Line
setTaken(member)
Object
Focus of
control
Condition
Slide23
Control Information
Condition
syntax: [ expression ] message-label
The message is sent only if the
condition is true
[ok] borrow(member)
Slide24
obj1:Class
obj2: Class
message()
[x < 15] calculate()
Slide25
Sequence Diagrams
obj1:Class
Slide26
Sequence Diagrams
Concurrency
obj1:Class
calculate()
message()
calculate()
Slide27
Control information
Iteration
may have square brackets containing a
continuation condition (until) specifying
the condition that must be satisfied in
order to exit the iteration and continue
with the sequence
may have an asterisk followed by square
brackets containing an iteration (while or
for) expression specifying the number of
iterations
Slide28
Control Information
Iteration
syntax: * [ [ expression ] ]
message-label
The message is sent many times to
possibly multiple receiver objects.
*draw()
Slide29
Control Information
Iteration example
:CompoundShape
draw()
*draw()
:Shape
:Driver
:Bus
Slide30
Control Information
Sequence Diagrams
: Created Object
message()
<<destroy>> X
Slide32
Creating Objects
Object Creation
:B
<<create>>
:A
<<create>>
:B
Constructor
Slide34
Object Destruction
:B
<<destroy>>
Slide35
Sequence Diagram
:Violations
Dialog
:Violations
Controller
:Violations
DBProxy
Clerk
lookup
viewButton()
Lookup
Traffic
Violation
id=getID()
getViolation(id)
display(v)
<<create>>
v:Traffic
Violation
DB is queried
and the result
is returned as
an object
Slide36
5)
6)
Slide37
1)
Slide38
3)
Slide43
Sequence Diagrams
:Cashier
: System
makenewSale()
enterItem(itemID, quantity)
description, total
endSale()
total
makePayment(amount)
change due, receipt
Slide44
Sequence Diagram
Slide45
Sequence Diagram
:Compiler
Linker
FileSystem
Actor
Compile
Load Files
Compile files
Save OBJ Files
Link
Load OBJ files
Slide46