Is a state without a direct transition allowed in UML state diagram (SD) like the below drawn with StarUML?
State1 is not directly involved in any transition so I'm in doubt wether this is allowed in UML / desirable. I think in my application I'm actually modeling multiple objects in a single SD.
Based on the UML 2.5 specifications, this kind of diagram is perfectly valid. Nevertheless, by deduction, we can understand that it is not the best approach.
According to the definitions (section 14.2.3.4.1
):
State1
is a composite state made of exactly one region. State2
and State3
are simple states, and in this case they are also direct substates of State1
A first answer to your question is suggested by the rules on entering a state (section 14.2.3.4.5
):
Explicit entry: If the incoming Transition or its continuations terminate on a directly contained substate of the composite State, then that substate becomes active and ...
This is also reinforced in the rules related to regions (section 14.2.3.2
), and more precisely to their activation:
Or a region starts at an explicit state (substate) if the region is activated by an entering transition:
an explicit activation occurs when a Region is entered by a Transition terminating on one of the Region’s contained Vertices.
So your diagram is perfectly valid, with an explicit transition from initial state to the substate State2
.
First of all, it is suggested (section 14.2.4.5.1) that it may help in some case to hide the decomposition of a composite state:
State1
instead of the direct transition to State2
. Then, if you'd later need to extend your composite state with multiple "orthogonal" regions:
The UML specs warn that if default activations are missing, one should consider the model as ill-defined, or that the region will never start. So it's safer to use a systematic approach, and always use default activation.