I know "all programs are state machines" and blah blah blah but isn't there something better than this recurring idiom:
switch( myState )
To me, these state machines are spaghetti code: even less readable than a function laced with gotos. Taking each state and making it a class makes it even worse - now I have to go digging through half a dozen source files to figure out what the code does. I've done both many times, of course, and always been mystified by my code later.
What's the alternative? Threads? Although the code reads cleaner it can't possibly worth the issues multithreading introduces.
I've got nothing, and I'm still grudgingly doing it as above. Anyone?