Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object Oriented Analysis and Design Sequence Diagrams.

Similar presentations


Presentation on theme: "Object Oriented Analysis and Design Sequence Diagrams."— Presentation transcript:

1 Object Oriented Analysis and Design Sequence Diagrams

2 Contents 2  Sequence Diagrams

3 Static vs. Dynamic Views of Software 3  Class diagrams show the classes which comprise a program  It does nothing to show you how to use those classes  You need  Examples of how to use the classes to accomplish a task  Examples of what methods to call  Examples of how to combine classes to do something useful  The sequence diagram accomplishes this by showing the software in a dynamic state

4 Uses of Sequence Diagrams 4  Each sequence diagram shows how to perform one task  Each message passed between objects is a real method call  Sequence diagrams are examples of how to use the classes to perform tasks

5 Sequence Diagrams 5  Sequence diagrams show how messages are sent from one object to another to accomplish a task  The sequence diagram concentrates on the time at which messages are sent  The sequence diagram makes it easier to see a sequence of interactions

6 Sample Diagram 6

7 Messages 7  The actions that objects perform on each other  Major types of messages  Flat flow of control  Procedure call  Return from a Procedure call  May have optional guard conditions

8 Sequence Diagrams 8  Uses rectangles to represent objects  Uses a dashed vertical line to represent the lifetime of the object  Uses a solid rectangle on top of the lifeline to represent when the object is active and has the flow of control  This is called an activation bar

9 Sequence Diagrams 9  Object names  A fully qualified object  Dan:Customer  An anonymous object  :Customer  Return values  Usually indicated by a dashed line going to the left

10 Sequence Diagrams 10  If the same method is called multiple times in an iteration, this is indicated by a guard condition beside the method  Other conditions can be placed before the method :Customer :Order [for each product] :addItem(product)

11 Sequence Diagrams 11

12 Timelines 12  A sequence diagram depicts time as increasing in the downward direction  Each object is on a timeline and first appears when it is created  Later on the timeline, it sends messages to and receives messages from other objects  The timeline let’s you easily see the order in which the messages are sent and received

13 Message Synchronization 13  Most messages are synchronous  This means that the caller waits for the message to complete before it continues to the next operation  If a message is asynchronous, the caller does not wait for the message to be completed before continuing to the next operation

14 Message Synchronization 14  Synchronous message use a solid arrowhead  Asynchronous messages use a stick arrowhead

15 Object Creation 15  Shows that an object is created in the sequence diagram  Known as a Constructor  Message points directly to the object being created as opposed to the timeline

16 Object Destruction 16  Shows that an object is destroyed in the sequence diagram  Known as a Destructor  Signified by an X at the end of the timeline

17 Sequence Diagram Messages 17  Messages indicate method calls  Can point to same object when it makes a recursive call  Can have multiple recursive arrows stacked to indicate multiple recursion  Can be slanted to indicate call takes time


Download ppt "Object Oriented Analysis and Design Sequence Diagrams."

Similar presentations


Ads by Google