Finite State Machines

GenFSM

  • What a Finite State Machine (FSM) is
  • An example FSM that we'll be implementing
  • How to implement an FSM using GenFSM

Finite State Machines

What they are

defmodule Something do
  use GenFSM.Behaviour
end

A means of modelling some computation.

  • It can be in one of a limited number of states;
  • It has an initial state;
  • It can transition from one state to another based on some event or condition.

Finite State Machines

Our example FSM

Example FSM

LIVE LIVE LIVE LIVE LIVE

CODING CODING CODING

ZOMG ZOMG ZOMG ZOMG

LIVE CODING ZOMG

Example FSM

LIVE CODING ZOMG

Example FSM

LIVE CODING ZOMG

Example FSM

LIVE CODING ZOMG

Example FSM

LIVE CODING ZOMG

Example FSM

Finite State Machines

Summary

Example FSM