This project is read-only.

Transition inside a composite state

Jun 2, 2010 at 11:44 AM

Is there any reason why we can't make any transtion between a composite state and is childs ?

It could be really usefull.

Jun 3, 2010 at 9:52 AM

Can you please give your scenario for such a usage? We need identify whether it's a common usage.

Jun 3, 2010 at 7:18 PM
Edited Jun 3, 2010 at 7:32 PM

Yes of course, to make things simple we have a composite state "WaitingState" with 2 children;

One is nammed "IdleState" who is our intial state and where the user can insert a document (ticket) in an optical card reader or select some basic buisness product from a touch screen.

The second is "UserSelectionState" where the user can still insert a document in an optical card reader or select more buisness products from a touch screen and finally convert the ticket to some other kind of buisness product. 

I need to tell you that the user can, in any time, insert a document (ticket) inside the optical card reader.

So, for our buisness logic to work, i have to do a  :

-transition (select business product)  between "IdleState" and "UserSelectionState"

-transition (insert a document)  between "IdleState" and "UserSelectionState"

-transition (select business product)  between "UserSelectionState" and "UserSelectionState"

-transition (insert a document)  between "UserSelectionState" and "UserSelectionState"

It will be more easy and more readable for me to have

--transition (select business product) between between "WaitingState" and "UserSelectionState"

--transition (insert document) between between "WaitingState" and "IdleState"

Like i told you the user can insert a document in any moment, so eventually , we will have many more transition who will share the same logic who will need to be duplicated because we can't use transition between a composite state and is childrens


Thank you, for answering us and for you great work on the state machine workflow, we really appreciate the new state machine model.

Jun 4, 2010 at 3:02 AM

Thanks for the scenario.  This scenara is valuable for us. We'll take consideration for our next release.  Based on current implementation, actually you can avoid too many transitions via put "IdleState", "WaitState" or any other "XXXState" (if you need) except "UserSelectionState" into a parent State named "Parent". This parent State can have a transition  (select business product)  between "Parent" and "UserSelectionState". So all state under this parent state will share this transition to "UserSelectionState". What you still need to add is the self transition on "UserSelectionState". That's a one time work.  So actually, you need specify the transition to "UserSelectionState" not more than 2 times. Does it make sense to you? 

Jun 7, 2010 at 11:38 AM

Thank for answering.

Yes, it make sense, in fact we came to the same thinking about how to remove some of our duplicate transitions.

This "Pattern" seems to be a good solution for now.