Making 🍩

with state machines

Jenny Truong

@jen_ayy_

Donuts are
awesome and
visually appealing

State machines
are awesome and visually
appealing
 

and also intimidating

Uneaten

Eaten

Finite states

One finite state at a time

Uneateneaten??

An event is a
thing that
happened

Events cause state transitions

Uneaten

Eaten

Bite

A state machine
always has an
initial state

There can be final states

Getting ingredients

Initial state

Mix dry ingredients

Getting ingredients

Mix wet ingredients

Mixed

Gathered

Getting ingredients

Gathered

Parallel

states

Mix dry ingredients

Mix wet ingredients

Mixing

Mix dry ingredients

Getting ingredients

Mix wet ingredients

Gathered

Knead

Mixed

Mixing

Knead

Rise

Kneaded

Shape

Raisin Risen

Shape

Cook

Made hole-y

Shape

Made hole-y

Cook

Heat

Fry

Flip

Fry other side

375℉ 🔥

after 2 min

flipped

Compound

states

Cool down

Cook

Cooked

Glaze

Won't burn you

Glaze

Eat!

Smothered in deliciousness

Final

state

stately.ai

Thank you, ODevs!

@jen_ayy_