UML is a short form of Unified Modeling Language. It is not a programming language like HTML or Java; instead, it is a visual language that is usually used in modeling various diagrams. UML is a set of symbols and definitions used to describe and visualize the different connections in a software system.
Behavioral and structural diagrams are two major types of UML diagrams. A behavioral diagram shows the changing features in a system. A few examples of this diagram include sequence, communication, and activity diagrams. Whereas a structural diagram shows unchanging relationships, like object, component, and class diagrams.
This article specifically focuses on the UML communication diagram, its primary purposes, the leading benefits, and how you can create one.
In this article
- UML Communication Diagram: What Exactly Is It?
- What Symbols and Elements Does a UML Communication Diagram Contain?
- What is the Primary Purpose of a UML Collaboration Diagram?
- When to Use this Diagram?
- Leading Advantages of a Communication Diagram
- How to Create a UML Communication Diagram?
- Summing It Up
Part 1. UML Communication Diagram: What Exactly Is It?
Before getting into the details of the UML communication diagram (also known as a UML collaboration diagram), let’s first understand what a communication diagram is.
A communication diagram visualizes an overview of all the messages exchanged between actors and objects within a function, process, or system. It is a kind of behavioral diagram that includes interaction and sequence diagrams.
Let’s understand the functionality of a UML communication diagram for an ATM.
- The user first sends a specific message to the ATM machine by inserting a debit/credit card and the key.
- Then, the ATM machine sends a message to the bank to ask for the user’s information.
- Last but not least, the bank approves the transaction and the user gets his/her money in hand. It all happens within minutes.
In a UML communication diagram, all messages are stated clearly with their precedence and direction. Arrows and straight lines are used to connect all objects represented by rectangles. An example of a communication diagram of an online bookshop is shown in the image below.
Part 2. What Symbols and Elements Does a UML Communication Diagram Contain?
Now that you are familiar with the diagram, it is time to explore the symbols and elements it carries to better understand the architecture of the diagram.
Symbols
Arrows, lines, rectangles, and numbers are four different symbols used in this diagram. Let’s explore them all a bit.
i) Arrows
These symbols are used to show the flow of messages received or sent throughout the whole process in a diagram.
ii) Lines
The straight lines connect different rectangles to display the relationships between two objects or more.
iii) Rectangles
They have a simple purpose with a simple shape. Objects are denoted by rectangles in a system. Each rectangle is labeled with the name of an object.
iv) Numbers
They tell how many messages are needed to complete a specific process. Plus, they show the order of the messages they follow.
Elements
Objects, links, messages, activity, and frames are different elements of the UML collaboration diagram. Let’s explore each element one by one.
i) Objects
A communication diagram consists of two types of objects: supplier and client. The supplier objects receive messages, and they supply the process or method. On the other hand, the client object requests supplier methods by sending messages.
ii) Links
The links between different objects are represented by lines in the diagram. They tell which objects are connected to each other. Plus, they help you understand the sending and receiving of messages between different objects. When an object sends a message to itself, it is denoted with a loop in the diagram.
iii) Messages
The flow of messages is represented by arrows. All messages are numbered sequentially. These sequential numbers help readers understand which message to read first. Multiple numbers and decimal points are used to represent messages attached to a parent message. Two types of messages include synchronous and asynchronous.
When a client object sends a message and waits for a supplier’s response, it is known as a synchronous message and is denoted by a solid line with a filled arrowhead. Whereas when a client object does not wait for a supplier’s response after sending a message, it is called an asynchronous message. It is denoted by the dashed line and hollow arrowhead.
iv) Activity
They are the actions that take place for a specific process to be completed. You can represent an activity with an oval or other shapes in the UML communication diagram.
v) Frames
A space containing the diagram is commonly called a frame. The title of the diagram is written on the top-left corner of the frame.
Please remember that they are not all the elements or symbols used in the UML collaboration diagram. You can find more in different diagrams. So don’t be confused when you see some new symbols in a similar diagram.
Part 3. What is the Primary Purpose of a UML Collaboration Diagram?
The leading purpose of this diagram is to display all the messages exchanged between objects to allow the system to do what a use case demands. When it comes to visualizing the sequence of messages between actors and objects, a UML collaboration diagram plays a crucial role.
Creating this diagram helps programmers and developers save energy and time. In addition, it assists them in avoiding making mistakes in the beginning. Moreover, the UML communication diagrams lend a helping hand in future redesigns, updates, and changes.
Part 4. When to Use this Diagram?
Well, this diagram is usually needed when developing a system to understand all the needs and how to build it appropriately. The diagramming interactions and messages state the function of the use case clearly.
Simply put, you can use a UML communication diagram to observe the sequence in which information or messages are sent and received. These diagrams perfectly model the order and flow of messages, allowing for a better understanding.
Part 5. 4 Leading Advantages of a Communication Diagram
When it comes to developing an effective system architecture or efficient system diagramming, a UML collaboration diagram plays a crucial role. Let’s look at the top advantages it offers.
i) Easy Interpretation
This diagram clarifies the role of all actors and objects within the system. Shapes and notations show messaging relationships between different parts of a particular system.
ii) Visualizes Complex Systems
It uses clear notations to visualize complex logic chains which contain various objects. A complete UML diagram presents a comprehensive overview of the system in a way that no further explanation is required.
iii) Shows Information Sequentially
As stated earlier, UML diagrams are known for displaying the flow and sequence of messages exchanged between different objects within the system. For example, what messages depend on others and what order they follow.
iv) Assists in Future Iterations
Planning future scenarios and functions becomes super easy with UML collaboration diagrams. They make it intuitive and simple to prototype and visualize systems.
Part 6. How to Create a UML Communication Diagram?
Before you start making this diagram, don’t forget to ensure that you have the right building blocks. When creating it from scratch, make sure you follow all the UML guidelines. We have listed 5 simple few steps below to make the UML collaboration diagram within minutes.
Step 1: Outline the Functions to Model
Decide on what functions are required to model the complete system, like objects, actors, and messages. The more messages and actions you visualize, the more complex the diagram will become.
Step 2: Add Figures and Shapes
Use rectangle shapes to show different objects in the system and name them all. Place all shapes with unified spaces between them. Use stick figures to show actors.
Step 3: Use Arrows to Visualize Messages
Now, connect arrows to objects that are connected with the lines. Each message is represented by one arrow. The direction of the arrowhead determines which object sends the message and which receives it. Make sure you use the same style for arrows throughout the communication diagram.
It is not necessary to place straight arrows, but you can bend them as and when needed. Plus, make sure you introduce a decent spacing between the lines. It becomes difficult to read if the lines are too close to each other.
Step 4: Label Arrows
Add the sequencing number and message ID on each arrow to denote the order of the message and what the message is about. To label and number the messages effectively, follow the best UML practices. Consider the industry’s standard sizes and fonts.
Step 5: Finalize and Share the Diagram
Adjust and organize all symbols and elements neatly so that it becomes easy to understand the flow of messages. Use different colors to differentiate message sequences and types of objects.
Once you are done, consult stakeholders and ask them to review and finalize the diagram you have created. Then, share the finalized diagram with your colleagues, team members, or other people you want.
Your communication diagram will look like the one shown below. However, different subjects may have different diagrams.
Summing It Up
A UML communication diagram is also known as a collaboration diagram. It is used to show the relationships between various objects. Plus, it shows how different messages flow throughout the system. This diagram shows relevant objects, their message parameters, and classes. In addition, you can model the messages exchanged between different applications.
From the primary purpose of the UML communication diagram to its symbols, elements, and leading benefits, the above discussion covers everything. Moreover, it presents a step-by-step guide to making a well-organized and well-structured UML collaboration diagram. Give it a careful read, and you will find everything you are looking for.