Types of interaction diagrams in UML
Interaction diagrams are divided into four main types of diagrams:
- Communication diagram
- Sequence diagram
- Timing diagram
- Interaction overview diagram
Each type of diagram focuses on a different aspect of a system’s behavior or structure. Take a look below for more information on the basics of each diagram and how you can benefit from them.
Communication diagram (or collaboration diagram)
In UML, communication diagrams depict the relationships and interactions among various software objects. They emphasize the structural aspects of an interaction diagram, focusing on object architecture rather than the flow of messages.
A communication diagram provides the following benefits:
- They emphasize how lifelines connect.
- They focus on elements within a system rather than message flow.
- They provide an added emphasis on organization over timing.
Communication diagrams can also have these possible downsides:
- They can become very complex.
- They make it difficult to explore specific objects within a system.
- They can be time-consuming to create.
Sequence diagram
Another option for depicting interactions is using sequence diagrams. These diagrams revolve around five main events:
- Order placement
- Payment
- Order confirmation
- Order preparation
- Order serving
If the sequence of events changes, it can cause delays, or the system may crash. It’s important to select the notation that matches the particular sequence within your diagram.
A sequence diagram provides the following benefits:
- They’re easy to maintain and generate.
- They’re easy to update according to changes in a system.
- They allow for reverse and forward engineering.
Sequence diagrams can also have these possible downsides:
- They can become complex, with too many lifelines and varied notations.
- They’re easy to produce incorrectly and depend on your sequence being entered correctly.
Timing diagram
Another diagram option can be to use timing diagrams. These are visuals used to depict the state of a lifeline at any instance in time, denoting the changes in an object from one form to another. Waveforms are used within timing diagrams to visualize the flow within the software program at various instances of time.
A timing diagram offers the following benefits:
- They allow for forward and reverse engineering.
- They can represent the state of an object at an exact instance in time.
- They can keep track of any and all changes within a system.
You should also consider these potential downsides of using a timing diagram:
- They can be difficult to understand.
- They can be hard to maintain over time.
Interaction overview diagram
The interaction overview diagram provides a high-level view of an interaction model. The diagram acts as an overview of the flow of control from interaction to interaction, as well as the flow of activity from diagram to diagram.
A timing diagram offers the following benefits:
- They provide an uncomplicated view of the activity within a model.
- They offer a high degree of navigability between diagrams.
- They allow the use of most annotations within an activity diagram, along with additional elements for added clarity.
Although interaction diagrams are fairly intuitive, they do require branching and interactions to follow certain behaviors, which can be restrictive.