Dynamic Models Sequence Diagrams Collaboration Diagrams Activity Diagrams.
Object Oriented Analysis and Design Sequence Diagrams.
-
Upload
anthony-sims -
Category
Documents
-
view
226 -
download
1
Transcript of Object Oriented Analysis and Design Sequence Diagrams.
Object Oriented Analysis and Design
Sequence Diagrams
Contents
2
Sequence Diagrams
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
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
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
Sample Diagram
6
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
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
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
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)
Sequence Diagrams
11
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
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
Message Synchronization
14
Synchronous message use a solid arrowhead
Asynchronous messages use a stick arrowhead
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
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
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