Improving software delivery in every organisation


Finite State Machines

If you’ve never encountered finite state machine (FSM) modelling before, here is what it looks like.

The following state machine is comprised of two states: “State 1” and “State 2”. There is a single event “event_name” that can take the state machine from State 1 to State 2.

Image of a Basic State Machine

One use case of FSMs is User Interface logic, consider the following:

Image of a Menu FSM

Each event of the finite state machine can be bound to application methods e.g.

Image with methods

The Kata

Build a finite state machine from scratch, that replicates the following Finite State Machine

Turnstile FSM

Once you have completed that, continue on to part 2 (remember the point is to learn about the impact of changing requirements, so no peeking!) you can find part 2 here