This article mentions about Finite State Machines (FSM), SCXML (
State Chart extensible Markup Language) and Apache Common's SCXML library. A basic ATM finite state machine sample code is also provided with the article.
Finite State Machines:
You probably remember Finite State Machines from your Computer Science courses. FSMs are used to design computer programs or digital circuits.
A sample Finite State Machine [2]
A FSM is simply an abstract machine that can be in one of a finite number of states.The machine is in only one state at a time; the state it is in at any given time is called the current state. It can change from one state to another when initiated by a triggering event or condition, this is called a transition. A particular FSM is defined by a list of the possible transition states from each current state, and the triggering condition for each transition.
[1]
SCXML Language:
A working draft called
SCXML (State Machine Notation for Control Abstraction, published by
W3C) can be used to describe complex state machines. SCXML is a general-purpose xml-based state machine language. It is still a draft and latest version is 16 February 2012. Click
here to get five minute introduction to SCXML documents.
Apache Commons SCXML Library:
Apache has an implementation aimed at creating and maintaining a Java SCXML engine capable of executing a state machine defined using a SCXML document, while abstracting out the environment interfaces. The latest stable version is 0.9.
Library Website: http://commons.apache.org/scxml/index.html
Eclipse Plugin: http://commons.apache.org/sandbox/gsoc/2010/scxml-eclipse/ (still under development)
UseCases: http://commons.apache.org/scxml/usecases.html
SCXML Editors:
Apache's Eclipse Plugin aims to provide a visual editor to edit SCXML files but it is still under development. There is also scxml gui (
http://code.google.com/p/scxmlgui/ ) which is very successful. You can also check State Forge's visual State Machine Diagram :
http://www.stateforge.com/StateMachineDiagram/StateMachineDiagram.html