Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Multiple State Machines?  (Read 7688 times)
albertkang75
Newbie
*
Posts: 7


View Profile Email
« on: September 12, 2009, 01:13:17 »

Is it possible/advisable to have multiple state machines in an app?

For example, have a state machine for the entire app (i.e - startup as used in the sea of arrows) and then have another state machine that is used for some forms that appear in a popup window (i.e a sort of like the FSM as described in the puremvc.tv).

Or should I just use the state machine for startup related things and then have a separate mediator handle the form and it's various states?



Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: September 13, 2009, 06:58:04 »

Using MultiCore, each core can have its own StateMachine. So if your Popup were a module with its own PureMVC core, you could go that way. If the popup talks to a service that nothing else in the app talks to, it might make sense to modularize and place the form, its mediator, the proxy that communicates with the service into a core. This also makes the whole business maximally reusable.

But more than likely, a State Machine instance for a form is not what you're looking for. Flex has view states, which allow a component to have multiple visual configurations. It takes care of all the business of state transitions for you, even animating them if you'd like. That combined with binding that enables and disables things based on the form is really the best way to encapsulate your form's behavior within the component.

-=Cliff>

Logged
Pages: [1]
Print