Search code examples
umlstatediagramfsm

transition with same start/end in UML state diagram


I am new to UML, regrading FSM diagram, how to represent two transitions that lead to same state, for example, I'm in state1:

when(event1)-->action1-->state2
when(event2)-->action2-->state2

I mean do I need to draw two lines from state1 to state2?


Solution

  • Yes, you have to draw two lines since the event and action is part of the line.

    as you can see in http://en.wikipedia.org/wiki/File:UML_state_machine_Fig1.png

    your line will get a text like "event1 / action1" and "event2 / action2".

    If you don't generate code from your diagram, you can also use one line and add a text like "event1 / action1 OR event2 / action2" if this is more readable.

    I consider UML as a guide - sometimes you have to change the rules a little bit in order to create something readable and useful. :-)