Archyno
UMLBehaviour diagrams

UML communication diagrams

The same interaction a sequence diagram shows, arranged to answer a different question: not when things happen, but who is connected to whom.

6 min readUML 2.5.112 of 15

1: submit(payment)2: authorize(amount)3: charge(card)4: post(entry): Merchant: Checkout: PaymentOrchestrator: CardGateway: Ledger
Authorizing a payment, as a communication diagram. Compare it with the same flow as a sequence diagram: identical content, and a completely different thing made obvious.

01What it shows

A communication diagram - called a collaboration diagram before UML 2 - shows a set of objects, the links between them, and the messages that travel along those links. It is one of the four interaction diagrams, and it carries exactly the same information as the equivalent sequence diagram.

What differs is what the layout emphasises. A sequence diagram spends its geometry on time: participants across the top, order down the page. A communication diagram spends its geometry on topology: objects wherever you put them, links drawn between the ones that talk. Order is demoted to a number in front of each message.

02The notation

ElementNotationWhat it means
Objectrectangle, underlined nameA participant, written role: Type. Same instance notation as an object diagram.
Linkplain lineThese two can communicate. The line itself carries no direction - it is the channel, not the traffic.
Messagesmall arrow beside the linkOne communication, labelled sequenceNumber: name(arguments). Several messages can sit on one link.
Sequence number1:, 1.1:, 2:The order. Decimals nest: 1.1 happens during 1.
Iteration1 * [i = 1..n]:The message repeats.
Guard1 [ok]:The message is only sent when the condition holds.

The nested decimal numbering is the part worth learning, because it is how this diagram expresses call depth without a vertical axis. Message 2.1 happens inside the handling of message 2. Read a communication diagram by number, not by position: 1, 1.1, 1.2, 2. Position is deliberately meaningless.

03Choosing between this and a sequence diagram

They are interchangeable in principle - a good tool converts between them automatically - so the choice is about the reader.

Prefer a sequence diagram when order is the subject, when there are many messages, or when you need combined fragments. Nothing in the communication notation matches an alt block for showing a branch, and past about a dozen messages the numbering becomes harder to follow than a vertical axis.

Prefer a communication diagram when the connection structure is the subject: which objects know each other, where the hubs are, whether the shape matches the architecture you intended. It is also the more compact of the two for a small interaction among many objects, because it does not reserve a column per participant.

Honest assessment: sequence diagrams dominate in practice, and if you only ever learn one interaction diagram, learn that one. Communication diagrams remain worth recognising - and worth drawing on the specific day when the question is about coupling rather than about order.

04When to draw one

Reach for it when

  • The question is who talks to whom, not in what order
  • Looking for coupling problems - hubs and unexpected links stand out
  • A small interaction spread across many objects, where a sequence diagram would be mostly whitespace
  • Showing that a design matches an intended structure, such as a pattern

Reach for something else when

  • The flow has branches or loops - fragments have no equivalent here
  • There are more than about a dozen messages; the numbering stops being readable
  • The audience already knows the structure and needs the ordering
  • You want to show elapsed time - use a timing diagram

In one line each

  1. 01Same information as a sequence diagram, arranged to show structure instead of time.
  2. 02Layout is the connection graph; position carries no meaning about order.
  3. 03Order lives in the message numbers, and decimals nest to show call depth.
  4. 04Read by number - 1, 1.1, 1.2, 2 - never by position on the page.
  5. 05Best when the question is coupling; use a sequence diagram when it is ordering or branching.
All articles