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.