Many Twisted protocol handlers need to write a state machine to record the state they are at. Here are some pieces of advice which help to write state machines:
- Don't write bit state machines. Prefer to write a state machine witch deals with one level of abstraction at a time.
- Don't mix application-specific code with
Protocolhandling code. When the protocol handler has to make an application-specific call, keep it as a method call.