Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sequence Diagrams Show Sequence of Interactions Between Objects.

Similar presentations


Presentation on theme: "Sequence Diagrams Show Sequence of Interactions Between Objects."— Presentation transcript:

1 Sequence Diagrams Show Sequence of Interactions Between Objects

2 Why use sequence diagrams? Sequence Diagrams ◦Realize use-cases ◦Show interaction between system objects Collaboration Diagrams are an alternative method also used in UML

3 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

4 Three Active Objects with Two Messages ChessboardDatabase Chess Player make move record move critique

5 Message Types Synchronous message (wait for return) Return messages ( response to previous message) Asynchronous messages (no wait) Flat (unspecified synchronization) Note closed arrowhead

6 Creating/Deleting Objects Send messages > and > Chessboard Database > critique >

7 Conditional Messages Chessboard Database > critique [unfavorable critique] >

8 Object State Rectangle with rounded corners W White to move Chessboard W Black to move White’s move

9 Branching ChessboardDatabase Chess Player [make move] critique [resign]

10 Alternative Flow ChessboardDatabase Chess Player [make move] [game over]

11 Control Rectangles Show when an object is involved in a sequence of messages ChessboardChessEngine Request Position Request Evaluation Database Record Data

12 Modeling Time Chess ClientChess Server Send Player’s Move Send Opponent’s Move Diagonal message lines indicate that the messages take time to transmit

13 Specifying a Time Constraint on a message Chess ClientChess Server Send Player’s Move Send Opponent’s Move {sendTime for player’s move<2 seconds}

14 Specifying a time constraint on a section Chess ClientChess Server Send Player’s Move Send Opponent’s Move {Roundtrip time < 1 second}

15 Modeling Loops Chess ClientChess Server Send Player’s Move Send Opponent’s Move *[while !gameOver]

16 Modeling Recursion ApplicationSorter Sort List

17 Arguments and Return Values Web Interface Database GPA = RequestGPA(studentName)

18 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.

19 Statechart Diagrams They look like activity diagrams, but they are showing state transitions.

20 Symbols Start Symbol End Symbol State Symbol (contains state name) Decision Points

21 Events Events are indicated by adding labels to the edges between states

22 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

23 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

24 Example (from Roff) CleanDirty Saved Data Entered / RecoredData() Deleted Data State Exit/ Reset Cancel/ EmptyData() Continue/ SaveData() Exit/ Reset()


Download ppt "Sequence Diagrams Show Sequence of Interactions Between Objects."

Similar presentations


Ads by Google