topleft
topright
Get your FSM on! Print E-mail
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 34 guests online

Supporters of PureMVC

Bloggers on PureMVC

PureMVC Blog-o-Sphere

PureMVC on Twitter

PureMVC on Twitter

PureMVC on Delicious

PureMVC on Delicious

PureMVC on Linked-in

PureMVC on LinkedIn

PureMVC Newsfeed

PureMVC on the Web

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

 
FlashDevelop has gained quite a bit of ground in the development community so naturally several folks have created templates to ease the burdon of creating implementation classes. We'll let you be the judge of which are the best.
 
• FDT PureMVC Templates, Well Formed and Pimped - Aron Woost
• PureMVC First Thoughts and FlashDevelop Templates - Dave Keen

• FDT Templates for PureMVC/AS3 Available - Pedr Browne

 

Prudential wanted an intimate but exciting way of communicating with customers, so Downstream created a coffee table with a twist—the Interactive Coffee Table. Visitors can navigate floor plans, see and edit their agenda for the visit, and browse images and info about Prudentials history in a technologically advanced multiuser environment. Downstream's programmers used ActionScript 3 on the Adobe Air runtime, the PureMVC framework to keep the code well structured, and Papervision3D for various 3D effects in the application.

 

Prudential Interactive Coffee Table

Downstream Design

 

 

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

Version 2.0 of the PureMVC JavaScript port is now available. It is a complete rewrite based on Mootools core for class simulation.

 

• Visit the PureMVC JS Port

 

The PureMVC AS3 / Flex EmployeeAdmin Demo has been refactored to use the standard demo look and feel, and to reflect the very latest best practices. If you are the author of a port of this demo, please read the version.txt file.

 

• Run the EmployeeAdmin Demo

• Visit the Project

• View the source.

 

The PureMVC Java MulitCore GWT EmployeeAdmin Demo has been updated, now using Google Web Toolkit 2.0.

 

• View the Demo

• GWT EmployeeAdmin Project

 

The AS3 Undo Utility adds the ability to undo/redo actions in your PureMVC based Flex, Flash or AIR applications. The latest version is ready for download, and be sure to check out the demo to see how to implement.

 

AS3 Undo Utility

Flex HistoryPanel Demo

 

The 3.0 release of PureMVC C# Standard now ships with complete API docs and supports .NET 3.5 & Silverlight 2.0 UPDATE: Get your mobile on! VS2008 Solutions added for PocketPC, Smartphone, and Windows CE!

 

PureMVC Standard for C#

PureMVC Silverlight Login Demo

 
Copyright © 2006-2008 Futurescale, Inc.