UML communication diagrams

By |2020-04-09T08:43:00+02:00September 25th, 2019|use cases|
Reading Time: 4 min

Communication diagrams are another way to visualize the information more commonly represented by UML sequence diagrams. They are simpler than sequence diagrams and only show the messages that pass between the objects or roles in a software program, infrastructure, or any kind of process.

If you have multiple scenarios in one use case, UML communication diagrams help you clearly identify what messages (data) need to be sent between objects/roles in each specific scenario.

Enable the UML shape library in draw.io

Make sure you enable the UML shape library in draw.io when you want to create a UML communication diagram:

  • In the left panel, click on More Shapes.
  • Scroll down to find the UML shape library in the Software section on the left, make sure the check box is selected, then click Apply.

If your team works with UML diagrams in Confluence a lot, you can customize draw.io to show this library by default.

UML communication diagram shapes

The notation used in UML communication diagrams is the same as is used in UML sequence diagrams, only much simpler:

  • Object: A rectangle is used for the object (or role). Supplier objects call the functions that supply the message and client objects receive the message. Each object may be a client or supplier at different times in each scenario.
  • Link: Solid connectors connect the objects to show that a relationship exists between the different objects (or to itself).
  • Message: One or more additional connectors with arrow heads show the messages that are passed between the objects and their direction.

Indicate the sequence in the message labels

The labels on these additional connectors should start with a number to indicates the sequence of the messages. Messages can be nested – simply use a decimal point 1.1, 1.1.2, etc. You can clearly see which message belongs to which function call.

In the simple example below, both the communication diagram and its matching sequence diagram visualize one scenario (user interaction) in the Habit Tracker app – the example used throughout all of the UML diagram blog posts.

As you can see in the communication diagram above, there are two functions that the user interface (UI) runs and sends messages “to itself”. This relationship is indicated with a link ‘loop’. Of course, the message it sends to itself is still numbered so you can see in which order all of the messages are sent.

UML communication diagrams only show messages

UML communication diagrams are clearly much simpler than sequence diagrams – they help you focus on the function calls, the data passed between the different objects and roles and the basic sequence. They don’t represent iterations, conditionals or parallel operations, all of which are possible in the more complex sequence diagrams.

In the example sequence diagram above, you can see a loop, where every habit’s history is fetched and displayed. This is simply not visible in the communication diagram.

This simplicity is even clearer in the next two diagrams that visualize what happens when a user performs a habit check-in – both the parallel execution and the two conditions are ignored.

Learn more about UML diagrams

There are 14 different types of UML diagrams, and you can pick and choose which ones make the most sense for your team and your project.

Communication diagrams are a form of interaction diagram, showing how the components pass messages (data) between each other. The other interaction diagrams focus on different aspects – sequence diagrams, timing diagrams and interaction overview diagrams are also used.

Learn more about the different types of UML diagrams: See when to use which type of diagram and how to create them using draw.io.

Share This Story, Choose Your Platform!

About the Author: