PART 3 / LESSON 21 · Overview free · interactive lesson in the full course

State machines and event-driven parsing

Represent behavior using explicit states and events, and reason about event ordering and validation.

View lesson accessAll lessons

What the lesson covers

The course lesson is called The state machine that never forgets. The heater controller tracks its mode with four boolean flags. A particular order of button presses leaves it heating and in fault at the same time. A state machine makes that impossible.

Before you start

Question to think about: Which events are allowed in each state, and what should happen to unexpected ones?

Preparation exercise: Draw a state table for an invented input parser and identify all valid and rejected transitions.

This is an original public study prompt, not the paid lesson or its solution. The interactive course contains the walkthroughs, labs, exercises and recaps.

Related free reading

Test your understanding

Practice free firmware interview questions and mock interviews · Assess your readiness