Search code examples
umlsequence-diagrameclipse-sirius

Occurrence- vs. execution-specification in Sequence Diagrams, when to use each?


In a sequence diagram, when should a message originate from an occurrence specification and when should it originate from an execution specification?

Likewise, when should the message's target be each of the two?

Clarification of terms

I understand that the terms occurrence specification and execution specification might not be familiar to most, as such I point them out on a sequence diagram.

In the following depiction, there are two messages (marked in red):

  • m12 which leads from and to occurrence specifications, and
  • m2 which leads from an occurrence specification to an execution specification (the cyan-coloured block).

picture from eclipse.org (source)

Most tools capable of drawing UML sequence diagrams place an execution specification on both sides by default -- why is that? -- as is the case with Visual Paradigm enter image description here

and MagicDraw

enter image description here


Solution

  • A nice summary of the terms is found at uml-diagrams.org.

    The UML spec says on pp. 578

    An ExecutionOccurrenceSpecification represents, on a lifeline, the start event or the end event of an ExecutionSpecification.

    and

    An ExecutionOccurrenceSpecification is represented by the start or finish endpoint of the vertical box for an ExecutionSpecification on a lifeline. See Figure 17.2.

    So they just mark the point in time when something happens. Actually there are a number of examples in the spec where timing constraints are also applied in conjunction with ExecutionOccurrenceSpecification.

    On p. 567:

    ExecutionSpecifications are represented as thin rectangles (gray or white) on the lifeline (see 17.3.4 (Lifeline)).

    We may also represent an ExecutionSpecification by a wider labeled rectangle, where the label usually identifies the action that was executed. An example of this can be seen in Figure 17.16.

    Simply speaking: there is something happening in a black box.

    Now for an OccurrenceSpecification there is a recursive definition in the specs on p. 566:

    The semantics of an OccurrenceSpecification is just the trace of that single OccurrenceSpecification.

    The understanding and deeper meaning of the OccurrenceSpecification is dependent upon the associated Message and the information that it conveys.

    (Wow!) But then on p. 567:

    OccurrenceSpecifications are merely syntactic points at the ends of Messages or at the beginning/end of an ExecutionSpecification.

    Actually an OccurrenceSpecification is just a more general form of the ExecutionOccurrenceSpecification.

    While fig. 17.2 uses ExecutionSpecification the following figures 17.3 etc. do no use them. So you are free to use them at your will.