From this, we get that accounts should certainly behave like state machines.
And from that, it’s reasonable that other pieces of code ought to be able to
dynamically inspect an account’s current state, as well as its complete graph
of states and transitions. That’s as much a part of its public interface as
any particular method.
I guess I'm fairly influenced by this book:
Practical UML Statecharts in C/C++: Event-Driven Programming for Embedded Systems
In particular, it discusses the main implementation strategies and why you'd want to use them. Also, the specific codebase described in the book is excellent. I use it all the time in implementing server software.
Get dozens of book recommendations delivered straight to your inbox every Thursday.