0

I am trying to model a case management system in a UML State Machine Diagram. It is an approval style process and the case can enter a withdrawn state at any time if it is no longer required. This means about 10 states can transition into this one which would result in many messy lines that dont add much value.

Does anyone have any suggestions on the best practices here? How would you manage this situation?

3 Answers 3

3

Depending on the level of conformance you need with the UML specifications (do you generate code from the state diagram, or is it just to aid communication with other developers), there are several options.

  1. If there is just one state like Withdrawn (with a lot of transitions into it from all different states), then you can wrap the other states in a compound state (a state with sub-states) and just have the transition from the compound state to Withdrawn.
    This is fully supported by the UML specification and will also work with code generators.

  2. If it is literally that you can transition from any state to Withdrawn, then you could add a "any state" pseudo-state to your state diagram. Such a pseudo-state is commonly indicated with the name "*".
    This is not supported by the UML specification, so code generation tools may not support it, but with a little supporting text it should pose no problem to human readers

  3. As indicated in the other answer, you can also duplicate the relevant state bubbles in the diagram. If you do this, it is highly recommended that you put an annotation next to the state name to indicate that it has been drawn at multiple places in the diagram and that they all represent the same state.
    This option is not supported by code generation tools and can also be cognitively hard on human readers, so use it sparingly.

2
  • The second option actually is defined in UML, at least in part. It is called "State list notation" and described in section 14.2.4.5.3. According to the specification all the states need to be listed, but I think it is no big stretch to interpret "*" as a list of all states. Commented May 4, 2022 at 14:37
  • Also the third option is allowed. Nowhere in the specification it is forbidden to show the same element multiple times in the same diagram. There might be tools that don't allow this, but they don't have the specification on their side. A code generation tool will not have problems with it, because in the model there is still only one state. At least there should be only one, if the tool follows the specification. Commented May 4, 2022 at 14:39
0

Found my answer. First, do not used right angled lines. Use straight lines. It gives you more flexibility in terms of linking one node to other nodes. Secondly, do not be afraid to copy and paste multiple nodes if it makes the design easier to read. I did this in visio and i am happy with how it is looking.

Hope this helps someone else.

0

You are allowed to have more than one diagram, and each can show different aspects of your model.

So you could create a separate "Withdrawn" diagram, showing all the links to that state.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.