A state machine is a behavior model.
Based on the current state and a given input the machine performs state transitions and produces outputs.
Basic building blocks of a state machine are states
and transitions
.
When you need to manage a system with distinct, predictable states and specific rules for transitioning between them.
Simple and linear process.
Highly dynamic or unpredictable workflows