State Machine Transitions

Hi Guys, I have a question for you about transitions in State Machines. If you see the REFramework you can see each transicion going out of the machine by different points:

image

But some times I see some REFrameworks like this, with all branches comming out from the same point:

image

I’ve been told that the difference is: when you create rules coming out from different points of the same machine (ex. T1: var.contains(“hello”), T2: var.contains(“world”), T3: exist=false) it can be possible of 2 of these transitions are true (ex. var=“hello world”) and this can cause some kind of error. But if you use all transitions coming out from the same point, the robot will be verifying each condition in order, so if T1 is true, the robot will enter just in this transition without entering the second one.

it is true?

In this case, both of the transitions are enabled. this is a situation of the so-called “conflicting transitions” (see UML Spec. 2.4.1., p. 575). Conflict resolution is generally rather complicated, see UML Spec. In your specific case, where both transitions leave the same state, the result is non-deterministic: either one of the transitions may be taken.

1 Like

Hi @KarthikByggari thank you for your comment.

So you think maybe the best use to handle this is trying to put all the transitions comming out from the same point?

When you put all transitions coming from the same point it look like a list of conditions and you can manage what ondition to do first. something like:

1.-Error
2.-Business
3.-Success

image

So if it’s there is a system error and business error the robot will go just for the system because it is the first transition the robot will look at. And if it is there a Success, the robot will find first it there is a System or Business Error.

So you think maybe the best use to handle this is trying to put all the transitions comming out from the same point?

It is called a shared transition. In case of shared transition, it should contain a unique condition and action.
Make sure that the condition will be unique.

From your screenshot it is straight forward that at a time only one transition gonna happen.
The order is fine.

More on state machines -

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.