Archive for February, 2010

Finite State Machines

February 7, 2010

Today’s reading material is about another ancient framework for software development — the finite state machine — but with a contemporary twist.

The finite state machine is one conceptual framework for breaking down a system or subsystem into modular, easily-testable, easily-maintainable pieces.  It essentially consists of a graph of states and transitions.  The machine is always in exactly one state, but inputs can cause it to transition to new states.

There are a number of ways of depicting finite state machines visually, but they typically involve a lot of bubbles and arrows, as in:

Finite State Machine (Magic Flute MIDI controller)

Edward J. Pring writes about using finite state machines to develop cutesy fading “tooltips” in JavaScript.  The demo:

Although the end result is a bit glitzy for my tastes, the thought process that went into creating it is so common-sense it’s uncommonly brilliant.

JavaScript has its flaws, but this article helped convince me that there is a little kernel of elegance to the language.  The article might not convince you, but it may just give you some ideas on how to design your next GUI.

Happy reading!