Show Sequence of Interactions Between Objects Why use sequence diagrams Sequence Diagrams Realize usecases Show interaction between system objects Collaboration Diagrams are an alternative method also used in UML ID: 184811
Download Presentation The PPT/PDF document "Sequence Diagrams" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Sequence Diagrams
Show Sequence of Interactions Between ObjectsSlide2
Why use sequence diagrams?
Sequence Diagrams
Realize use-cases
Show interaction between system objects
Collaboration Diagrams are an alternative method also used in UMLSlide3
Basic Elements of a Sequence Diagram
Active Objects
Actors or Objects
Notated using the UML notation for class instances
“Life line” appears below active objects to indicate their lifespan
Messages
Arrowed lines that indicated communication between objects
Slide4
Three Active Objects with Two Messages
Chessboard
Database
Chess Player
make move
r
ecord move
critiqueSlide5
Message Types
Synchronous message (wait for return)
Return messages (
response to previous message)
Asynchronous messages (no wait)
Flat (unspecified synchronization)
Note closed arrowhead Slide6
Creating/Deleting Objects
Send messages <<create>> and <<destroys>>
Chessboard
Database
<<create>>
critique
<<destroys>>Slide7
Conditional Messages
Chessboard
Database
<<create>>
critique
[unfavorable critique] <<destroys>>Slide8
Object State
Rectangle with rounded corners
W
White to
move
Chessboard
W
Black to
move
White’s moveSlide9
Branching
Chessboard
Database
Chess Player
[make move]
critique
[resign]Slide10
Alternative Flow
Chessboard
Database
Chess Player
[make move]
[game over]Slide11
Control Rectangles
Show when an object is involved in a sequence of messages
Chessboard
ChessEngine
Request Position
Request Evaluation
Database
Record DataSlide12
Modeling Time
Chess Client
Chess Server
Send Player’s Move
Send Opponent’s Move
Diagonal message lines indicate that the messages take time to transmitSlide13
Specifying a Time Constraint on a message
Chess Client
Chess Server
Send Player’s Move
Send Opponent’s Move
{
sendTime
for player’s move<2 seconds}Slide14
Specifying a time constraint on a section
Chess Client
Chess Server
Send Player’s Move
Send Opponent’s Move
{Roundtrip time < 1 second}Slide15
Modeling Loops
Chess Client
Chess Server
Send Player’s Move
Send Opponent’s Move
*[while
!
gameOver
]Slide16
Modeling Recursion
Application
Sorter
Sort List
Sort ListSlide17
Arguments and Return Values
Web Interface
Database
GPA =
RequestGPA
(
studentName
)Slide18
Adding Notes to Diagrams
Chess Client
Chess Server
Send Player’s Move
Send Opponent’s Move
Send a move and get a move. If connection is lost, an automatic reconnect is attempted.Slide19
Statechart Diagrams
They look like activity diagrams, but they are showing state transitions.Slide20
Symbols
Start Symbol
End Symbol
State Symbol (contains state name)
Decision PointsSlide21
Events
Events are indicated by adding labels to the edges between statesSlide22
Actions
Actions show the behavior associated with an action
Actions are:
Entry – what happens on entry
Exit – what happens on exit
Do – what happens while in the state
Include – an additional
statechart
diagramEvent – how to respond to an eventSlide23
Action Notation
For non-events
Action-label/action for non-events
For events
Event-name(parameters) [guard] /action
Examples:
Entry/
numberOfStudents
=0RestUsers(users) [Users->
forAll(Open = False)] / users->emptySlide24
Example (from Roff
)
Clean
Dirty
Saved
Data Entered /
RecoredData
()
Deleted
Data State
Exit/ Reset
Cancel/
EmptyData
()
Continue/
SaveData
()
Exit/ Reset()