State Machines and User Interface work — any examples/experience?

I’m currently working with a (proprietary) framework that lends itself well to the UI-as-state-machine paradigm, and it can definitely reduce (but not eliminate) the problems with complex and unforeseen interactions between UI elements.

The main benefit is that it allows you to think at a higher level of abstraction, at a higher granularity. Instead of thinking “If button A is pressed then combobox B is locked, textfield C is cleared and and Button D is unlocked”, you think “Pressing button A puts the app into the CHECKED state” – and entering that state means that certain things happen.

I don’t think it’s useful (or even possible) to model the entire UI as a single state machine, though. Instead, there’s usually a number of smaller state machines that each handles one part of the UI (consisting of several controls that interact and belong together conceptually), and one (maybe more than one) “global” state machine that handles more fundamental issues.

Leave a Comment