How (not) to code a finite state machine
Douglas W. Jones · ACM SIGPLAN Notices · 1988
The standard advice for those coding a finite state machine is to use a while loop, a case statement, and a state variable. This is usually bad advice! The reasons for this are explored here, and better advice is formulated.