You are on page 1of 20

Ahram Canadian University

Faculty of Computer Science and Information Technology


Department of Software Engineering

Object Oriented Software Development


SWE403

Dr. Mervat Helmy Hussein

Fall 2023 – Lecture 7


b- Object Oriented Analysis (Analysis Workflow)
Dynamic View: represents the interactions of the objects in a system
- how the objects work together
- how data is moved from storage to a user view,
- how objects are created and manipulated,

Sequence Diagram, Collaboration diagram, State chart diagram

Sequence Diagram (Event diagrams):


• Ties use cases with objects (object level rather than class level)
• Build a Sequence diagram for each Use Case (scenario)
• If an operation appears in more than one sequence diagram, its behavior
should be the same.

2
3
ReportEmergency Use Case.. cont.

4
Figure1: Sequence diagram for the ReportEmergency Use Case
5
Figure 1: Sequence diagram for the ReportEmergency Use Case.. cont.
6
Figure 1: Sequence diagram for the ReportEmergency Use Case.. cont.
7
Drawing Sequence Diagram
• Objects represent the participants (objects and actors), actors may be outside
the system, represented by rectangles
- written as Instance Name : Class Name or written as Class Name
- The left-most one is the actor who initiates the use case

Figure 2: Object
representation
8
Drawing Sequence Diagram
Objects that are created during the interaction are given a «create» message pointing to the
created object.

Ex.: an object of class


ReportEmergencyForm
is created when object
of ReportEmergencyControl
sends the «create» message
and is destroyed once the
EmergencyReportForm
has been submitted.

Figure 3: Object creation


9
Drawing Sequence Diagram
Objects that are destroyed during the interaction have a cross indicating object end.
Ex.: object of class
ReportEmergencyForm is
destroyed once the
ReportEmergencyForm
submits Report
(submitReport).

This is usually in response to a


message such as delete or
cancel.

Figure 4: Destroying of Object


10
Drawing Sequence Diagram

Figure 4:
Destroying of
Object

11
Drawing Sequence Diagram
• Object lifelines: arrange the messages in the proper relative sequence
- represented by columns (dashed then as a vertical rectangle when active)
- length of vertical rectangles represents the time the operation is active to
show its lifetime

Figure 5: Lifeline of Object

12
Drawing Sequence Diagram
• Messages (stimuli) represent the communication sent between objects
- represented by horizontal arrows across objects
- solid arrow line represents a message that requires a response and
dashed arrows are the responses.
- messages are placed horizontally onto the timelines ordered
- use the square condition brackets to indicate either the number of times
or the condition for repetitions,
Ex: .[for each product]: additem (product)
- same condition brackets may be used to control whether a message is
even sent

13
Drawing Sequence Diagram
Messages

Figure 6: Messages in Sequence diagram


14
15
Drawing Sequence Diagram-- notations
1. Object lifeline
2. Message/Stimulus
3. Iteration: an operation should be performed repeatedly
4. Self-reference: recursive function
5. Return
6. Anonymous object (only using class name)
7. Object name
8. Sequence number
9. Condition: uses the test [product available = yes] to make certain that the previous
step succeeded before performing the operation
10. Basic comment

16
Figure 7: Notations
in Sequence diagram

17
Drawing Sequence Diagram-- notations
1. Activation: The start of the vertical rectangle, the activation bar
2. Deactivation: The end of the vertical rectangle, the activation bar
3. Timeout event: Typically signified by a full arrowhead with a small clock face
or circle on the line
4. Asynchronous event: Typically signified by a stick arrowhead
5. Object termination symbolized by an X

18
Drawing Sequence Diagram-- notations
• Reference #1 shows when the object becomes active at the top of the rectangle.
Note that the object becomes active when it begins to do work.
• Reference #2 shows when the object is deactivated or finishes its work and waits for
the next request

Ex.: Inventory object is only active while it is responding to the “productAvailable”


inquiry, and the Order is activated more than once: once to create the Order object and
once each time it is asked by Bill to perform “addItem.”

• Reference #3 points to a message with a circle on the line and the stereotype
<<timeout>>. This is called a timed event.
• There is also a condition or a constraint on the message that expresses the timing
parameters for the event, for example: if we don’t get a response from inventory
within 2 seconds we will bypass the item and check later.
19
Drawing Sequence Diagram-- notations

Reference #4: An asynchronous message uses a stick arrowhead instead of the solid
arrowhead. Messages may be synchronous (requiring a response) or asynchronous (not
requiring a response).

20

You might also like