State machines are wonderful tools
No post on state machines would be complete without mention of the superset concept of Petri nets [1].  I have used Petri nets to build my own workflow engine previously.  Building a workflow engine is one of those things... nearly every enterprise app has one, and normally you shouldn’t need to build one if you can source one... but it is an exercise that makes you a stronger engineer&#x2F;developer too, deepening understanding of the patterns that lie beneath most systems.<p>Back when I was building, openly available workflow engines, BPML, BPEL etc. were not really a thing yet, so it made a little more sense to be building one.<p>[1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Petri_net" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Petri_net</a>