language-lawyerumlsequence-diagram

What is the exact meaning of a strict fragment?


In a recent question I stumbled over this example:

enter image description here

The UML 2.5 spec says on p. 617:

The InteractionOperatorKind strict designates that the CombinedFragment represents a strict sequencing between the behaviors of the operands. The semantics of strict sequencing defines a strict ordering of the operands on the first level within the CombinedFragment with interactionOperator strict. Therefore OccurrenceSpecifications within contained CombinedFragment will not directly be compared with other OccurrenceSpecifications of the enclosing CombinedFragment.

Well, that leaves me with question marks. What would be the difference in the above if you don't have the fragment and only the messages? They would appear in this (strict) order anyway. Right? Or is it like: do the first, if that fails the 2nd and if that fails the 3rd? Probably not! But what is it then?


Solution

  • Since there are no reply messages modeled, it is not specified, whether the sender waits for them, before sending the next message. Without the strict operator it would therefore be possible that the reception of search_google() is after the execution in reaction to search_yahoo(). With the operator, the occurrences in each operand will all occur before the occurences in the next operand.

    The example would be less confusing, had they used asynchroneous messages.

    Of course the question is, how is it ensured that only the trace defined by the strict operator can happen. In the case of asynchroneous messages the sender has no way of knowing, whether search_google() finished executing. I think other traces are possible, but the current diagram describes what happens after the combined fragment, if the strict ordering is observed.

    The sentence on "Occurrence Specifications within contained CombinedFragment" refers to nested CombinedFragments:

    sequence diagram with nested CombinedFragments

    The nested CombinedFragment opt doesn't obey the strict operator. Therefore, m1 can happen before or after m3. I don't have a good example where this is useful, but it's how the specification defines it.