9.2.                    Collaboration diagrams

A collaboration diagram is a graphical view of a scenario that depicts object interactions around objects and their links to one another. It captures a snapshot of the stream of events exchanged between objects during a scenario.

A free standing parameterised collaboration with a well-known name is called a design pattern [Detsis, 2000; Gamma et al., 1995; Muller, 1999].

Collaboration diagrams are usually applied in real-time and/or embedded systems. A collaboration diagram demonstrates how the objects of a use case collaborate to achieve critical parts of the behaviour of the use case. In comparison to sequence diagrams, collaboration diagrams add information about the timing of the messages. There are four kinds of messages that are propagated between the objects of a collaboration diagram:

  1. A synchronous message corresponds to an object method which receives it and which initiates execution only when the sender object has sent the message and the receiver object is ready to accept the message.
  2. A balking message is the same as a synchronous message, but the sender object cancels the message if the receiver object is unable to accept it.
  3. A timeout message is as a synchronous message, but the sender object waits for the receiver object to be ready to accept the message.
  4. An asynchronous message refers to send a message no matter if the receiver object is ready to receive it or not.

A sample collaboration diagram is shown in Figure 10 .

Figure 10 Example collaboration diagram

Sequence vs. collaboration diagrams

·         Both diagrams present primarily the same information

o        Collaboration diagrams are more graphical

o        Sequence diagrams are more tabular

·         Collaboration diagrams are often better early in the development cycle before classes have been defined in detail

·         Sequence diagrams allow the display of more interaction and are more useful later in the development cycle

· Sequence diagrams put emphasis on sequence (order in which things occur)

·   Collaboration diagrams show the graphical layout; they indicate how objects are statically connected