How I Learned to Stop Worrying and Love the State Machine
Eric Lippert&#x27;s &quot;Wizards and Warriors&quot; blog posts seem appropriate here, especially as an example of how tracking state and OO can clash pretty badly.<p><i>A common problem I see in object-oriented design is:<p>A wizard is a kind of player.<p>A warrior is a kind of player.<p>A staff is a kind of weapon.<p>A sword is a kind of weapon.<p>A player has a weapon.<p>But before we get into the details, I just want to point out that I am not really talking about anything specific to the fantasy RPG genre here. Everything in this series applies equally well to Papers and Paychecks, but wizards and warriors are more fun to write about, so there you go.<p>OK, great, we have five bullet points so let’s write some classes without thinking about it! What could possibly go wrong?</i><p><a href="https:&#x2F;&#x2F;ericlippert.com&#x2F;2015&#x2F;04&#x2F;27&#x2F;wizards-and-warriors-part-one&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ericlippert.com&#x2F;2015&#x2F;04&#x2F;27&#x2F;wizards-and-warriors-part...</a><p><a href="https:&#x2F;&#x2F;ericlippert.com&#x2F;2015&#x2F;04&#x2F;30&#x2F;wizards-and-warriors-part-two&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ericlippert.com&#x2F;2015&#x2F;04&#x2F;30&#x2F;wizards-and-warriors-part...</a><p><a href="https:&#x2F;&#x2F;ericlippert.com&#x2F;2015&#x2F;05&#x2F;04&#x2F;wizards-and-warriors-part-three&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ericlippert.com&#x2F;2015&#x2F;05&#x2F;04&#x2F;wizards-and-warriors-part...</a><p><a href="https:&#x2F;&#x2F;ericlippert.com&#x2F;2015&#x2F;05&#x2F;07&#x2F;wizards-and-warriors-part-four&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ericlippert.com&#x2F;2015&#x2F;05&#x2F;07&#x2F;wizards-and-warriors-part...</a><p><a href="https:&#x2F;&#x2F;ericlippert.com&#x2F;2015&#x2F;05&#x2F;11&#x2F;wizards-and-warriors-part-five&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ericlippert.com&#x2F;2015&#x2F;05&#x2F;11&#x2F;wizards-and-warriors-part...</a>