From here there is a really nice summary of FSMs:
What is a state machine?
A state machine is an abstract concept that describes
States: A finite state describes some "mode" or "status" that a system (e.g., an app or component) is in. State machines always start in an initial state. Final states mark that a machine is "done". Extended state describes contextual data that is not finite, but relevant to the machine. Don't confuse finite ("countable") states with extended ("infinite") states!
Events & Transitions: An event is a "signal" that something happened. Events can trigger "transitions" between states. Transitions are always zero-time; they happen instantaneously. (Promises & async can still be modeled as a state machine. Just think of "awaiting" as a finite state.) Events are distinguished by a finite set of types and sometimes carry extra data.
Actions: Actions are side-effects that are executed due to events. Transition ("do") actions are executed due to transitions. (These are characterisitic of Mealy machines). Entry actions are executed whenever a state is entered. Exit actions are executed whenever a state is exited. (These are characteristic of Moore machines.)
Last modified 07 October 2024