I have an UML state machine diagram, which looks like this:
+-----------------------------------+
| A |
| +------+ E1 +------+ | E2 +-----+
o-->| o-->| A1 |------>| A2 |------------->| B |
| +------+ +------+ | +-----+
| |
+-----------------+-----------------+
| E3
V
+-----+
| C |
+-----+
In reality, composite state A has so many sub-states that I'd like to extract it into a separate diagram. This means that the transition arrow from A2
to B
must be cut in half by an exit point.
But where should I put event E2? I think, I should put it on both sides of the exit point, that is, in both diagrams:
High-level diagram (the o-o
is the decomposition icon, and (X)
is the exit point):
+-----------+
| |
| | E2 +-----+
o-->| A (X)------>| B |
| | +-----+
| o-o |
+-----+-----+
| E3
V
+-----+
| C |
+-----+
Low-level diagram:
+------------------------------------+
| A |
| +------+ E1 +------+ E2 |
| o-->| A1 |------>| A2 |----->(X)
| +------+ +------+ |
| |
+------------------------------------+
Note that E2
is shown in both diagrams. Unfortunately, I cannot find anything in the UML spec to support this idea. On the contrary, this approach apparently causes a conflict (see section 14.2.3.9.3). But I think there is no conflict here:
- Both transitions make the system leave state
A
and enter stateB
. So they practically form one transition. - Both diagrams are easy to understand because both show
E2
, and the exit point looks like a "gate" between the two diagrams, through which the system's state "moves" from(A, A2)
toB
. I think it would be confusing to showE2
only on one side of the exit point. - If there were another similar transition, for example from
A1
to a stateD
(not shown), then it could be handled the same way, with a second exit point. However in that case the two exit points should be labeled differently (for example: "Exit from A1" and "Exit from A2").
Is this valid UML? If not, how should I solve this problem?