Communication Diagrams

From EUDP
Jump to: navigation, search

What

Communication diagrams for modelling how objects interact with each other in central scenarios of use cases or other types of processes.

Communication diagrams are also known as collaboration diagrams.

Communication diagram2.jpg

This communication diagram illustrates a well known process. The alarm clock rings, but it has no effect on the sleeping child. A parent takes over and repeatedly tries to wake up the child.

How

The dish

Communication Diagrams

Ingredients

Class Diagram

Process

Objects and messages are drawn almost alike in sequence diagrams and communication diagrams. An object is drawn as a rectangle labelled with the name of the object and the name of the class separated by a colon - the object name is optional. A message is modelled by using an arrow labelled with the name of the message, the names of the parameters and the return value.

Relationships from the class diagram (associations, aggregations, compositions etc.) are modelled by straight lines and the order of the messages is modelled by adding a sequence number to the message as in contrast to a sequence diagram where time passes from top to bottom. You can add a condition to the sequence number that must be satisfied for the message to be sent. It is also possible to indicate that a message is iterated by using an asterisk - ?*´.

Why

You use communication diagrams and sequence diagrams for the same purpose. Both types of diagrams model how objects interact with each other and they should both provide you with an answer to the following question: "When does Who do What With Whom, When".

A sequence diagram will answer this question leaving no doubt, but a sequence diagram can get pretty packed if it contains a lot of objects. If this is the case, you can use a communication diagram which will give you a bird's eye view of the process the diagram is modelling.

A communication diagram has some of the forces of the class diagram, but it is not as precise as the sequence diagram when it comes to the "when" part of the question above.

Example

Communication Diagram3.jpg

The diagram is from an early stage in the development process. It shows two - somewhat - independent systems. One system used by the user to feed the system with the desired temperature and another system for regulating the heat according to the wishes of the user.

The user enters the desired temperature which is submitted to a server-page and the server-page updates the database. Once in a while a piece of software will wake up, read the database and compare the desired temperature with the temperature inside, outside and the temperature of the supply pipe. It will also check the effect of the solar panel before the boiler is adjusted, if needed.

In this case the developers use notes in order to remember the discussions they had when they constructed the diagram. As an example these notes could pinpoint risky parts of the system - for example if the developers lack expertise in order to construct a certain object.


Used In

Communication Diagrams is used widely in the design process to give the necessary overview. You may also want to study the Sequence Diagrams.