Presentation on theme: "Sequence Diagrams Show Sequence of Interactions Between Objects."— Presentation transcript:
Sequence Diagrams Show Sequence of Interactions Between Objects
Why use sequence diagrams? Sequence Diagrams ◦Realize use-cases ◦Show interaction between system objects Collaboration Diagrams are an alternative method also used in UML
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
Three Active Objects with Two Messages ChessboardDatabase Chess Player make move record move critique
Message Types Synchronous message (wait for return) Return messages ( response to previous message) Asynchronous messages (no wait) Flat (unspecified synchronization) Note closed arrowhead
Arguments and Return Values Web Interface Database GPA = RequestGPA(studentName)
Adding Notes to Diagrams Chess ClientChess 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.
Statechart Diagrams They look like activity diagrams, but they are showing state transitions.
Symbols Start Symbol End Symbol State Symbol (contains state name) Decision Points
Events Events are indicated by adding labels to the edges between states
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 diagram Event – how to respond to an event
Action Notation For non-events ◦Action-label/action for non-events For events ◦Event-name(parameters) [guard] /action Examples: ◦Entry/numberOfStudents=0 ◦RestUsers(users) [Users->forAll(Open = False)] / users->empty
Example (from Roff) CleanDirty Saved Data Entered / RecoredData() Deleted Data State Exit/ Reset Cancel/ EmptyData() Continue/ SaveData() Exit/ Reset()