4 ms·
A decent rule of thumb I sometimes apply is: 1. What I have could be formalized into a state machine. 2. That state machine needs to be reused and re-entered.
by megameter 6y ago
A decent rule of thumb I sometimes apply is:
1. What I have could be formalized into a state machine.
2. That state machine needs to be reused and re-entered.
3. I want to apply inputs to the state machine with method calls.
Of course you can overapply the thought and end up with an enterprise architecture - that's why YAGNI is important. But when a section builds up a bit of conceptual redundancy there's usually a state machine that can be pulled out of it in OO form.
And I would certainly do it that way in Python, as well as other languages.