Event-driven programming and state machine
https://en.wikipedia.org/wiki/Event-driven_finite-state_machine
https://barrgroup.com/embedded-systems/how-to/state-machines-event-driven-systems
https://en.wikipedia.org/wiki/Event-driven_finite-state_machine
https://barrgroup.com/embedded-systems/how-to/state-machines-event-driven-systems