Using state machine to write bug-free code

The article explains how you can use State Machine to write bug-free code.