2

In an UML state diagram, branches in the process flow can be modeled using choice elements (represented by a diamond-shaped symbol) with conditions on the outgoing transitions (see example).

On the other hand, junction elements (represented by a filled circle) can be used to merge several incoming transitions and/or split the process flow into several outgoing transitions, which may also have conditions (see example).

So is a junction really a generalisation of a choice? Is there a situation in which you must use a choice and could not use a junction?

Gerd
  • 2,568
  • 1
  • 7
  • 20
  • 1
    A choice may also have multiple incoming flows. If you don't use actions on incoming transitions, then a choice is equivalent to a junction. If you have an action on the incoming transition, then with a junction, the guards are evaluated before executing the action and with a choice, the guards are evaluated after executing the action. – www.admiraalit.nl Sep 19 '19 at 14:21

1 Answers1

3

According to UML 2.5.1 specification, section 14.2.3.7, the difference between junction or choice outgoing transition's is when their associated guard is evaluated.

If the outgoing guards evaluation might change according during behavior evaluation, you must use choice pseudostate. If the outgoing guards evaluation will never change, you can of course use both but junction could be more clear.

Hoping it helps, RedBeard

Red Beard
  • 3,436
  • 1
  • 14
  • 17
  • What do you mean by 'behavior evaluation'? Does this behavior consist exclusively of the action(s) on the incoming transition(s) or can it also be earlier behavior? For example, could entry actions of states passed earlier influence the evaluation of a guard leaving the choice pseudostate? – www.admiraalit.nl Sep 19 '19 at 14:26
  • 1
    From my understanding, 'behavior evaluation' mean during the behaviour execution. So all passed actions, transtion, states, etc. influence the evaluation of choice transition guards. Junction guard evaluation should be independante of the behaviour execution. – Red Beard Oct 03 '19 at 08:28