3

I'm a newbie at UML statechart notation, I'm trying to simulate that there are two fired action on the same triggered event but one of these actions is optional depending on a condition.

The following is just a simulation for my need, so is the following notation is true or false?: enter image description here

Mahmoud Emam
  • 1,499
  • 4
  • 20
  • 37

2 Answers2

3

In UML State Diagrams, each transition is triggered by one and only one event. In your case it seems that one event will cause a transition to two different states or, as you noted, had an optional path. What I would personally advise is the following:

An UML State Chart Showing a Pseudostate to branch on the conditional leading to an optional task being executed.

What I did is use a Pseudostate to branch on the condition you mentioned. So if your condition holds, you transition to the bottom most final state, if not you transition right. While the end state is the same, your diagram now clearly outlines different behaviour on each transition.

I apologize for not using the correctly rounded box, the online drawing tool I used didn't provide these. As you can see I used two final states but you can use only one, both are permitted in UML.

Eric Tobias
  • 3,225
  • 4
  • 32
  • 50
0

In fact, according to UML psecification, only one "effect" or action can be trigerred by a given transition. So in order to triger yours two actions you have to model two transitions (internal or external). For me, your condition should be express as a guard as you already understood. So do you really have two actions which an optional one, or according to a given guard you have an actio or another!? Could you describe a little bit more your usecase?

Red Beard
  • 3,436
  • 1
  • 14
  • 17