topleft
topright
Get your FSM on!
Monday, 01 December 2008

Image If you've ever wrestled with how to represent and manage the states of your PureMVC application, you'll be glad to know that an exciting new utility called StateMachine has been added to the PureMVC repositories.

 

The result of several weeks of collaboration between myself and the author Neil Manuell, this utility is an extremely powerful tool for formalizing the discrete states of your application in the simplest, most approachable form we could deliver. State is no longer the random basin of stability your app falls into after certain input is given and the app has responded. Nor is it something you'll have to jump through hoops to implement!

 

Currently supporting AS3 Standard and MultiCore, the utility provides a simple yet effective Finite State Machine (FSM) implementation, which allows the definition of States, and the valid transitions to other States allowed from any given State, and the actions which trigger the transitions.

 

Each State may also have associated entering and exiting Notifications, which allow the application to respond appropriately to the phases of a transition. Transitions can also be canceled, by notifying the StateMachine during the exiting phase of the transition, before the new State has been established.

 

To make your application's FSM extremely easy to define, use and understand, a dependency injection mechanism is provided. FSMInjector reads the entire FSM, expressed in a simple XML format, and injects a fully populated StateMachine into the PureMVC app.

 

The XML format for the FSM Injector is simple. For instance here is the FSM for a lockable door:

 

<fsm initial="CLOSED">
<state name="OPENED" entering="openingNote" exiting="aboutToCloseNote">
<transition action="CLOSE" target="CLOSED"/>
</state>
<state name="CLOSED" entering="closingNote">
<transition action="OPEN" target="OPENED"/>
<transition action="LOCK" target="LOCKED"/>
</state>
<state name="LOCKED" entering="lockingNote">
<transition action="UNLOCK" target="CLOSED"/>
</state>
</fsm>
 

The above FSM defines three discrete States OPENED, CLOSED and LOCKED.

 

  • The actions OPEN, CLOSE and LOCK are used to trigger State transitions.
  • It is only possible to LOCK the door when it is CLOSED, because only the CLOSED State defines a transition targeting the LOCKED state.
  • It is not possible to OPEN the door from the LOCKED State because no transition is defined targeting the OPEN State.
  • And when you UNLOCK the door, it returns to the CLOSED State, where it is once again possible to OPEN or LOCK.
  • An exiting notification is defined only for exiting the OPEN State to illustrate that entering and exiting Notifications are optional.
  • The CLOSED State's entering Notification ("closingNote") will be sent not only when transitioning to CLOSED from OPEN or LOCKED, but also when the StateMachine is first registered, since the FSM's initial State is CLOSED.

 

Download the StateMachine utility and check it out today!

 

Delicious
Technorati
Reddit
Furl it!
NewsVine
YahooMyWeb
Stumble
blogmarks
Digg
co.mments
connotea
 

Who's on PureMVC.org

We have 7 guests online

OReilly PureMVC Book

PureMVC Book

PureMVC on Google

PureMVC Blog-o-Sphere

PureMVC on Twitter

PureMVC on Twitter

PureMVC on Delicious

PureMVC on Delicious

PureMVC on Linked-in

PureMVC on LinkedIn

Supporters of PureMVC

PureMVC on the Web

João Pescada has produced a nice PureMVC / AS3 demo - a searchable image gallery. 
 
Photo Search with PureMVC - Article  -  Code  -  Demo

 

 
Jonathan Campos has put together a nice introductory PureMVC article with an example built around the Netflix API.
 
Netflix API with PureMVC Article

 
The guys over at Pyjamas (a Python port of GWT) have made their compiler so efficient that it can take virtually any Python library and it will compile to Javascript. They loved the look of PureMVC Python, and decided to do a couple of demos that use it.
 

Pyjamas Project

• EmployeeAdmin Demo: Original / Pyjamas  

Pyjamas PureMVC Timesheet Demo

 
Chandima Cumaranatunge, co-author of the O'Rielly book AS3 Design Patterns, and long-time PureMVC community member recently created a simple Flash/AS3 MultiCore demonstration application accompanied by an informative article that's an excellent introduction to the benefits of working with MultiCore.
 
Who Moved the Cheese? - Demo / Source / Article

ActionScript 3 Design Patterns

 

Ahmed Nuaman has published a well conceived and received AS3/PureMVC tutorial at FlashTuts.com. It's a good place for the learner to get their feet wet, and goes into the difference between using PureMVC with Flex as opposed to Flash or pure AS3.

 

Understanding the PureMVC Open Source Framework

FlashTuts Website
Ahmed's Website

 

 

Recent Project Activity

PureMVC Standard Version for Perl 1.0  has been released, complete with unit tests and online documentation.

 

PureMVC Standard Framework for Perl

 

Release 1.3 of the AIR DesktopCitizen Utility which allows applications to remember their window size, position and maximized/minimized state each time it is launched. It also provides a facility for requiring confirmation (or executing some shutdown process) before the application window closes.

 

AS3 / AIR Desktop Citizen Utility

CodePeek Demo

 

The classic PureMVC EmployeeAdmin Demo has been ported to yet another language! Although PHP is usually thought of as a server language, using PHP-GTK, Sasa Tarbuk recreates th a desktop app. 

 

 
Version 1.0.8 of the PureMVC Java MultiCore port is now available. It supports JavaFX and handles threading properly.

 

 

The PureMVC Java MulitCore GWT EmployeeAdmin Mobile Demo has been released. Using Google Web Toolkit 2.0, it runs on iPhone, iPad and Android. 

 

 
Copyright © 2006-2008 Futurescale, Inc.