is it valid that a state machine can have more than one possible state for some transition?

Posted by shankbond on Programmers See other posts from Programmers or by shankbond
Published on 2014-06-06T07:11:27Z Indexed on 2014/06/06 9:38 UTC
Read the original article Hit count: 211

I have a requirement for a workflow which I am trying to model as a state machine, I see that there is more than one outcome of a given transition(or activity).

Is it valid for a state machine to have more than one possible states, but only one state will be true at a given time?

Note: This is my first attempt to model a state machine.

Eg. might be:

s1->t1->s2

s1->t1->s3

s1->t1->s4

where s1, s2, s3, s4 are states and t1 is transition/activity.

A fictitious real world example might be:

For a human, there can be two states: hungry, not hungry A basket can have only one item from: apple, orange.

So, to model it we will have:

hungry->pick from basket->apple found

hungry->pick from basket->orange found

apple found->eat->not hungry

orange found->take juice out of it and then drink-> not hungry

© Programmers or respective owner

Related posts about design-patterns

Related posts about object-oriented