3

In UML sequence diagrams, there is the possibility to specify a synchronous call with a reply message.

Example (taken from https://en.wikipedia.org/wiki/Sequence_diagram)

sequence diagram

When modelling that in mermaid-js, it renders "OKish":

open arrow end

However, the syntax is "strange" (because, for the reply, it uses is the notation for asynchronous messages)

sequenceDiagram
    A ->> B: m1
    B --) A: m2

mermaid-js seems to propose closed arrows as default:

closed arrow head

Synntax in mermaid-js:

sequenceDiagram
    A ->> B: m1
    B ->> A: m2

I checked the UML 2.5.1 specification on page 577; there it reads:

A reply Message (messageSort equals reply) has a dashed line with either an open or filled arrow head

I have found no explanation for "either an open or filled arrow head".I also checked PlantUML (at https://plantuml.com/en/sequence-diagram), it also uses the open arrows.

Question: Is it open to the modeler which arrow head to use without altering the semantics of the reply arrow? Is mermaid-js the only tool leaning towards closed arrows?

2 Answers 2

4

The majority of tools use an open arrow for reply messages. This has historical reasons: in early days of UML and up to UML 1.4, the reply message was called "return" and was to be represented as a dashed line with an open arrow head. There was no freedom to chose the form of the arrow head.

UML 2 has introduced more flexibility. Probably, the idea was to allow pairing of reply head with the initial message head (synchronous vs asynchronous). But without meta model support and without any semantic difference, the new styles failed to be really adopted, not to speak of the countless tutorials and books that still use the term "return message" and do not even mention the possible graphical choice.

Popular tools therefore continue to use only open arrows. Examples: StarUML, Visual Paradigm, Enterprise Architect, Modelio, PlantUML, ...

4
  • Thank you for pointing to the historic versions of UML (which were the times, I was learning UML, too).
    – koppor
    Feb 17, 2023 at 20:19
  • 1
    I took part in the discussion in the UML taskforce about this decision. The reason is simply, that nobody could remember, why it was an open arrowhead in the first place. It would have been logical to make it a filled arrowhead, since it can only happen after a synchroneous message. However, that would break a lot of existing diagrams. Therefore, both versions are now allowed. Feb 20, 2023 at 16:14
  • @AxelScheithauer Thanks for this insight which confirms the pairing hypothesis. But you really made my day with the forgotten reason of the open arrow in first instance.
    – Christophe
    Feb 20, 2023 at 20:20
  • If the open arrowhead is interpreted as "issuer doesn't wait for an answer", it makes sense that the reply value uses an open arrowhead.
    – A. Richard
    May 31, 2023 at 10:28
4

Based on the UML 2.5.1 specification, the graphical notation for reply messages is defined as allowing both open and closed arrow heads and it is the decision of the modeler to decide which one to use. It should be noted that in Table 17.2 of the UML 2.5.1 specification, the example of a reply message is shown with an open arrowhead, and I do not see any examples with a closed arrowhead.

Since I'm not familiar with all UML modeling tools, I can't tell you if any other tools use a closed arrowhead or which tools those are. However, based on the examples in the Mermaid documentation, it does appear that your second example that results in the closed arrowhead is the preferred, since --) is the notation for asynchronous messages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.