问题
Has anyone used message branching in sequence diagrams? Does anyone know what this is specifically used for?
To the best of my understanding it is used to show a single message being received by multiple recipients

I have just seen it used to show concurrency, but I think that is incorrect and should be described by a "par" fragment or inside a co-region.

Thoughts and opinions?
回答1:
UML 2+
As far as I know there's no such thing as message branching in sequence diagrams in UML 2+ (but see the end).
To begin with, a Message
is a pair of sendEvent
and receiveEvent
, where both the sendEvent
(for foundMessage) and receiveEvent
(for lostMessage) can be optional, but it cannot have multiple senders/receivers.
If anything, your diagram would be two different message sends, because if you have two receivers, then each one presents a different receiveEvent
(and therefore a unique Message
).
Furthermore the notation you've used is odd, because [emphasis mine]
In an interaction diagram each vertical line describes the time-line for a process, where time increases down the page. The distance between two events on a time-line does not represent any literal measurement of time, only that non-zero time has passed.
so the non-horizontal line means non-zero time interval, and the spec doesn't make a mention of such bent lines.
UML 1.3 (<2)
I've found message branching in UML 1.3 (http://doc.omg.org/formal/2000-03-01.pdf)
Variation: Branching
A branch is shown by multiple arrows leaving a single point, each labeled by a guard condition. Depending on whether the guard conditions are mutually exclusive, the construct may represent conditionality or concurrency.
However UML 1.3 doesn't have a well-defined metamodel.
Summary
As far as I can tell, message branching was dropped from the specifications starting from UML 2. It can however be represented by two separate messages with well-defined Ordering
, or by using par
fragment if it is parallel (which is not the same thing).
来源:https://stackoverflow.com/questions/36060968/uml-sequence-diagram-message-branching