0% found this document useful (0 votes)
10 views12 pages

Collaboration Diagram

Collaboration diagrams are UML models that depict the interactions between objects and classes through message exchanges. They illustrate the sequence of messages for system operations identified in use case diagrams and can be complemented by sequence diagrams. The diagrams also include notations for iterations, collections, and conditional paths to represent complex interactions within the system.

Uploaded by

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

Collaboration Diagram

Collaboration diagrams are UML models that depict the interactions between objects and classes through message exchanges. They illustrate the sequence of messages for system operations identified in use case diagrams and can be complemented by sequence diagrams. The diagrams also include notations for iterations, collections, and conditional paths to represent complex interactions within the system.

Uploaded by

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

Collaboration Diagrams

A collaboration diagram is a network model of


the messages between interacting objects and
classes.

There is a UML convention for numbering the


messages to show the sequence in which they
occur.
Collaboration Diagrams

For each system operation


identified in the Use Case Diagrams, and
described in a contract
Design a system of interacting objects to perform the
operation.

The collaboration diagram will indicate the objects


participating in the collaboration, and
The sequence of messages {message(parameters), sender,
receiver} exchanged to achieve the task involved.
Collaboration Diagrams

Actor System

System Op SystemOp
:ClassA
Operation:xxx
+
Precondition:.. 1: message1()

:ClassB

Use Case
Contract
Diagram Collaboration
Diagram
Alternatively (or perhaps primarily)
Sequence Diagrams can be used
instead of Collaboration Diagrams
Sequence Diagrams

Actor System

:ClassA :ClassB
System Op
SystemOp
Operation:xxx message1()
+ Precondition:..

Use Case Contract


Diagram Collaboration
Diagram
Collaboration Diagrams
Notation

Student :Student John:Student

class instance named instance

The Collaboration diagram should consist of illustrations of


the messages sent to objects of the classes identified in the
creates/destroys, reads, changes sections of the contract. The
system operation will be directed to one of the objects in this
group that will act as the controller for executing this task.
Collaboration Diagrams

Illustrating links

UML standard syntax for messages

return := message(parameter : parameterType) : returnType

sysOp() optional

1: tot := total():integer
:POST :Sale

sender receiver
Collaboration Diagrams
Illustrating Iteration

SystemOp( )

1*: [i:=0..9] str : getName(): String


CS335:ClassList
:Grader

sender receiver
Sequence number followed by Iteration clause is optional
a * indicates iteration
Collaboration Diagrams
Illustrating Iteration

In the example described on the previous slide, we


assumed that the target object contained a sequence of
names (simple strings) as an attribute. More generally
the ClassList may be considered a collection of
StudentRec objects, and messages may be directed to
the collection. The depiction of a message to a
multiobject – a group of objects stored in a collection –
is indicated on the next slide.

1: message( )
:ClassA

Representation of a collection (multiobject)


Collaboration Diagrams

Given: A vector of StudentRecord

1: inx := find(name: String): integer


v: vector

Version 1 – message to a collection (but vector is NOT a


concept in the problem domain)

1: inx := find(name: String): integer


:StudentRecord

Version 2 – (preferred) Emphasizes the objects in the


collection, not (the solution domain) container.
Collaboration Diagrams
Conditional Paths – mutually exclusive messages

msg1( )

1a: [test] msg2( ) :ClassB


:ClassA
guard – if true send msg

1b: [not test] msg4( ) 1a.1: msg3( )

1b.1: msg5( )
:ClassC :ClassD
Collaboration Diagrams

Creating a new instance during implementation of


the system operation

New
1: create( )
c: Controller m:MenuItem

2: add(m)
:MenuItem

Create a new MenuItem, m, and add it to the Menu

You might also like