A finite state machine (FSM) is a model of a system which:
- can only be in one of a given number of possible states at any moment
- accepts input events that may outputs (actions) or a change in state.
FSM can be represented with state transition diagram.
Javascript Promise as FSM Traffic light as FSM. Note that a transition may have actions associated with itStatechart is an extension of FSM with adding concepts of nested states, history state, conditional transitions etc that allows modular modelling system behavior with abstraction.