title: How to use state pattern correctly?
body: <p>I've encountered a few implementations of state pattern in my programming experience, and done a few. I've seen them used in various scenarios (mostly UI and parsing). The trouble is that all of them under pressure of rapid development turned into hardly maintainable and understandable chunks of code. I'm considering refactoring one of these, but I'm having trouble finding good resources for this online. There are many simple examples of State Pattern online, but I need some more in depth resources. </p>
  
  <p>So I'm looking for:</p>
  
  <ul>
  <li>Examples of common pitfalls when
  implementing state pattern and how to
  avoid them, </li>
  <li>Real world examples of
  state pattern done correctly (like in
  some open source project/framework)   </li>
  <li>Personal experiences with state
  pattern are also welcome</li>
  </ul>
  
  <p>Thank you for your time</p>