The hierarchical representation of finite state machines in UML 2.0 gives great information compression so you don't have to describe all possible state combinations. UML also provides so called orthogonal states that is they aren't mutually exclusive. And as far as I undertand this idea, if an object produces some activity in these states in response to the same event, activities corresponding to each state should simply be combined. The question arose while working on reverse engineering UML State Machine Diagrams from legacy C++ code. The refined C++ code and UML diagram are given:
void CSomeClass::somePublicMethod()
{
if (false == m_A)
{
return;
}
if (true == m_B)
{
m_C = otherMethodWithSideEffects();
}
if (false == m_C)
{
// some logic with side effects and state transitions
return;
}
// other complex logic with side effects and state transitions
}
UML state machine diagram:
On the one hand states B and C aren't completely independent, on the other hand the notion of concurrent states makes diagram much simpler. Can you suggest a better solution or tell me where I'm wrong?