March 24, 2007

Finite State Machines

Posted by Ben Simo

Software behavior can be modeled using Finite State Machines (FSMs). FSMs are composed of states, transitions, and actions. Each state is a possible condition of the modeled system. Transitions are the possible changes in states. Actions are the events that cause state transitions. For example, the following FSM shows the expected behavior of a car keyless entry system.




Images like the above are great for human use, but not machines. State transitions and the actions that trigger them can also be defined in a table format that can be processed by a computer. The above FSM can be represented using the table below.





The requirements for each state can also be defined using tables. The table below contains sample requirements for example keyless entry system.

  Edit

1 Comment:

May 11, 2007  
Anonymous wrote:

Mr Simo,

I applaud your promotion on the usefulness of FSMs in software(testing). You would probably be interested in Staccato(TM) at www.mapletechproductions.com.