Does this sound familiar? You arrive at work one morning and immediately set out towards the kitchen to have your first coffee. You open the cupboard… to reveal empty shelving, no cups in sight. Undeterred, you make your way towards the dishwasher but instead of a set of clean tableware for you to use, you discover a new civilization living inside the machine and it’s well on its way to discovering the wheel. Doing what a typical human would do after encountering an alien civilization, you shut the door and start the “summary annihilation” cycle. Forty-five minutes later you empty the dishwasher, clean mugs gleaming in the morning light. Unfortunately, your heroic deed goes completely unrecognized among your coworkers, no paparazzi, no camera flashes to greet you even though you made a sacrifice for the greater good; there is just no place for altruism in this cold and cruel world. Your heart hardens and in this bout of despair you decide to forge a ring of great power.
Applications tend to have a set of states with various transitions between them. Modeling them as finite state machines can help disassemble the problem of building the whole application into several separate smaller parts. This separation can be further improved by maximizing the hermetization of the resulting components. One possible way to reduce coupling between the modules is to abstract out the transition logic into a separate entity, which I call the