State-Machine Hate
“Quick, how many FSMs are there in your code?” Zero, right? (Yeah, I didn’t need to say “Quick” — you already knew the answer) A better question might have been “ How many places in your code could benefit from using an FSM? ”. This, one is a lot more discuss-able, with pro-FSM and anti-FSM camps getting into the usual thing (if you’re hankering for entertainment, grab some popcorn, and then ask a group of erlang devs about gen_fsm ). Rephrasing the question yet again into “ How come there are no FSMs in your code? ”, you usually get responses like “ I didn’t need them when I started ”, and “ They’re too complicated ”. And now we get to the heart of the matter. Let’s parse these two responses “ I didn’t need them when I started ”: We’re all trained to incrementally add behavior to our code, and, when you’re starting out, it just doesn’t seem like the system is worth the time, energy, and effort associated with using an FSM. “ They’re too complicated ”: Rem...