18
Duration: 3hrs 1 Ramakant Soni Assistant Professor Dept. of Computer Science B K Birla Institute of Engineering & Technology, Pilani, India Ramakant Soni @ BKBIET Pilani

Lecture 7 collaboration diagram

Embed Size (px)

Citation preview

Duration: 3hrs

1

Ramakant SoniAssistant Professor

Dept. of Computer Science

B K Birla Institute of Engineering & Technology, Pilani, India

Ramakant Soni @ BKBIET Pilani

Collaboration Diagram Definition

Collaboration Diagrams captures dynamic behavior ofthe objects in the system (message-oriented).

They are very useful for visualizing the relationshipbetween objects collaborating to perform a particulartask.

Ramakant Soni @ BKBIET Pilani 2

Their purpose is to:

Model flow of control

Illustrate coordination of object structure and control

Collaboration Diagram Elements

There are three primary elements of a collaboration diagram:

1. Objects 2. Links 3. Messages

Ramakant Soni @ BKBIET Pilani 3

3. Messages

What it represents?

Collaboration Diagrams illustrate object interactions in a graph or network format.

Ramakant Soni @ BKBIET Pilani 4

Notations used for Collaboration Diagrams

To show an instance of a class, the

regular class box graphic symbol is

used, but the name is underlined.

Additionally a class name should be

preceded by a colon.

Ramakant Soni @ BKBIET Pilani 5

An instance name can be used to

uniquely identify the instance.

Links, Messages and Return Value

Ramakant Soni @ BKBIET Pilani 6

“Self” Messages

A message can be sent from an object to itself.

This is illustrated by a link to itself, with messages flowing along the link.

Ramakant Soni @ BKBIET Pilani 7

Conditional Messages

A conditional message is shown by following a sequence number with

a conditional clause in square brackets, similar to the iteration clause.

The message is sent only if the clause evaluates to true.

Ramakant Soni @ BKBIET Pilani 8

Iteration or Looping

Iteration is indicated by following the

sequence number with a star( * ).

This expresses that the message is being

sent repeatedly, in a loop, to the

Ramakant Soni @ BKBIET Pilani 9

sent repeatedly, in a loop, to the

receiver.

It is also possible to include an iteration

clause indicating the recurrence values.

Representing Collections (Multiobject)

A multiobject is a set of instances.

Ramakant Soni @ BKBIET Pilani 10

EX1: Collaboration Diagram

Ramakant Soni @ BKBIET Pilani 11

Class diagram for : Make a phone call

EX1: Sequence to Collaboration Diagram

Ramakant Soni @ BKBIET Pilani 12

Process for : Make a phone call

EX1: Sequence to Collaboration Diagram

Ramakant Soni @ BKBIET Pilani 13

Collaboration diagram for : Make a phone call

EX2: Sequence to Collaboration Diagram

Ramakant Soni @ BKBIET Pilani 14

Sequence diagram for : change Airline itineraries

EX2: Sequence to Collaboration Diagram

Ramakant Soni @ BKBIET Pilani 15

Collaboration diagram for : change Airline itineraries

EX3: Sequence to Collaboration Diagram

Ramakant Soni @ BKBIET Pilani 16

Sequence diagram for : hotel reservation

EX3: Sequence to Collaboration Diagram

Ramakant Soni @ BKBIET Pilani 17

Collaboration diagram for : hotel reservation

References:

[1] http://www.uml-diagrams.org/

[2] http://en.wikipedia.org/wiki/Collaboration_diagram

[3] http://www.uml-diagrams.org/Collaboration-diagrams-examples.html

Ramakant Soni @ BKBIET Pilani 18

ThanksThanks

18