0% found this document useful (0 votes)
122 views30 pages

OOAD Lect9 Communication Timing Interaction Diagrams

This document discusses various interaction diagrams used in object oriented analysis and design, including sequence diagrams, communication diagrams, and timing diagrams. Sequence diagrams show the order of messages over time, while communication diagrams show the same interactions in the context of the participating classes and their structural relationships. Timing diagrams focus on timing constraints and show object behavior over time with the time axis running left to right and lifelines arranged vertically.

Uploaded by

Asad Abbas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views30 pages

OOAD Lect9 Communication Timing Interaction Diagrams

This document discusses various interaction diagrams used in object oriented analysis and design, including sequence diagrams, communication diagrams, and timing diagrams. Sequence diagrams show the order of messages over time, while communication diagrams show the same interactions in the context of the participating classes and their structural relationships. Timing diagrams focus on timing constraints and show object behavior over time with the time axis running left to right and lifelines arranged vertically.

Uploaded by

Asad Abbas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 30

Object Oriented

Analysis and Design


(OOAD)
M2I322952

Lecture 9
Other Interaction Diagrams
Communication (Collaboration) Diagrams
Timing Diagrams
Interaction Overview Diagrams

(UML@Classroom – chapter 6.7 )


1
2
Sequence & Communication
Diagrams

3
Sequence & Communication Diagrams
• Sequence diagrams :
– show interactions and emphasise the order of the messages
over time

• Communication (collaboration) diagrams :


– Show same interaction in the context of the classes that
participate in the interaction
– Show the structural relationships of the classes to one another

4
Screens / Sequence Diagram
You should consider the following :

• What data (attributes) has to be entered by the User?


• What information (attributes) have to be displayed ?
• What objects/attributes have to be checked ?
• What objects/attributes have to be updated ?

5
Communication Diagrams
• These are a kind of Interaction diagram
• Previously (before UML 2) called collaboration diagrams
• Like sequence diagrams, they are used to model interactions
between objects that deliver the functionality of a use case by
showing the messages that are passed between participants
(usually objects)
• A communication diagram looks like a class/object diagram, but it
has :
– messages added to the links between classes
– a numbering system before each message to give the order in
which they are sent.
6
Uses of a Communication Diagram
• Can be used while the class diagrams are being elaborated to
help the analyst understand the groupings of objects that
participate in the realisation of the use case

• They can also be used to specify the objects that take part in
operations

• We need to remember that the process of developing an


Object-Oriented System is iterative – these interaction
diagrams might identify new classes/attributes/operations
that need to be added to the class diagram

7
Uses of a Communication Diagram
If they’re similar to sequence diagrams, why do we need
them and when do we use them?
 In general :
 sequence diagrams are better at showing the sequence of calls (messages)
 communication diagrams are better at showing links between
objects/participants.
 Sequence diagrams are better for showing control logic, like loops
and selection (if .. else) .
 However, Communication diagrams are easier to draw and to
change quickly. Easier in brainstorming sessions (e.g. scribbling
on a whiteboard). If used like this, it’s a similar technique to CRC
cards.
8
Order Customer

-datereceived : Date * 1 -lastName: String


-number : String -firstName : String
-discount: Double
-calcBasePrice() -address : Address
-calcDiscount()
+calcPrice() +getDiscount()
1

1 .. * Here is the class diagram for the use case


Order Line
In order to carry out the task – calculate the order
-quantity : Integer price – the objects have to communicate with
-product : String each other . They communicate using their
operations. This is what we mean when we talk of
+getQuantity() passing messages.
+getProduct()
* Look at each class to see what information objects
of the class would hold and what operations they
1 can carry out.
Product
-price : Money
+getPrice() 9
Here is the Sequence diagram for the price calculating use case.
On the next slide it is shown as a Communication diagram

calcPrice

10
calcPrice

11
Notation of
Communication Diagrams

12
Participants

objectName objectName:ClassName :ClassName

Syntax for name of lifeline is the same as for Sequence


diagrams.

13
Links

Participant name Participant name

Participant name

Links are ONLY drawn on communication diagrams to support


the passing of messages between the participants in the
interaction 14
Messages
Messages are shown by an arrow pointing in the direction that the
message is sent and a label that specifies the message
message

Participant name Participant name

A message is the same as a message in Sequence diagrams, and is defined as a


specification of the conveyance of information from one instance to another
with the expectation that activity will ensue

A message may specify the raising of a signal or the call of an operation

Message may be one of the following:


• a signal sent from one object to another
• an operation being invoked on another object
• creation/destruction of an object instance 15
Messages .. continued
• The arrow represents the flow of control

• The message arrows are the same as those for


sequence diagrams

• Where the flow of control is synchronous there is only


one thread of execution – the activity passes from one
lifeline to another

• Where the flow of control is asynchronous more than


one lifeline can be active at any one time 16
Messages .. continued
Sequence expression message

1:getQuantity
anOrder anOrderLine

The syntax for messages is the same as that for sequence diagrams

Sequence-expression [attribute=] signal-or-operation-name [(arguments)]


[:return-value]

However, the notation for communication diagrams includes the


sequence-expression (a number) at the start

17
Sequence expression (numbering)
• Sequence expression defines the order in which the
interactions take place
• It is a dot separated list of sequence-terms followed
by a colon
• Each term represents a level of nesting within an
interaction
• If an object receives an operation call numbered 1:
and as a result sends an operation call to another
two objects
– the operation calls will have sequence expressions 1.1: and
1.2:
18
Recurrence (loops)
• Used for messages that are sent iteratively or are sent
depending on a guard condition

• Shown using an *
– e.g. *[while not end-of-file]

• It is equivalent to a loop combined fragment in a


sequence diagram
19
20
21
How to produce Communication diagrams
• Decide on the context of the interaction: system,
subsystem, use cases or operation
• Identify the structural elements (objects, subsystems)
necessary to carry out the functionality of the
interaction
• Model the structural relationships between those
elements to produce a diagram showing the context of
the interaction
• Consider the alternative scenarios that may be
required
• Draw communication diagram 22
StarUML
• A Communication (Collaboration) Diagram can
be easily created from an existing Sequence
Diagram :

– Select Sequence Diagram in Model Explorer

– From Main Menu :


• Model -> Convert Diagram -> Sequence to Collaboration
• Tidy up Diagram – using drag-and drop

23
Other Types of
Interaction Diagrams
• Timing Diagrams
• Interaction Overview Diagrams
Interaction Diagrams
In UML – there a FOUR types of Interaction
Diagrams :

– Sequence Diagrams
– Communication Diagrams
– Timing Diagrams
– Interaction Overview Diagrams
Timing Diagram
• A Timing Diagram is a specific type
of interaction diagram, where the focus is on
timing constraints.

• Timing diagrams are used to explore the


behaviours of a single object or a collection of
objects throughout a given period of time.
Timing Diagram
• A timing diagram is a special form of a sequence
diagram.
• The differences between timing diagram and
sequence diagram are the axes are reversed so
that :
– time is increased from left to right
– lifelines are shown in separate compartments
arranged vertically.

• Timing Diagrams are not frequently used


Example

Sequence Diagram

Communication Diagram

28
Timing diagram

• Both of these examples illustrate alternative ways of


showing the timing constraints.

• Both diagrams show the same basic information.

• The main difference is :


– Ex. 1 shows the state changes by moving from one horizontal
line to another
– Ex. 2 retains the same horizontal position but shows state
changes with a cross.

• The style of Ex. 1 works better when there are just a few
states, as in this case, and Ex. 2 is better when there are
many states to deal with.
Timing diagram

30

You might also like