How I Learned to Stop Worrying and Love the State Machine
Eric Lippert's "Wizards and Warriors" blog posts seem appropriate here, especially as an example of how tracking state and OO can clash pretty badly.A common problem I see in object-oriented design is:A wizard is a kind of player.A warrior is a kind of player.A staff is a kind of weapon.A sword is a kind of weapon.A player has a weapon.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.OK, great, we have five bullet points so let’s write some classes without thinking about it! What could possibly go wrong?https://ericlippert.com/2015/04/27/wizards-and-warriors-part...https://ericlippert.com/2015/04/30/wizards-and-warriors-part...https://ericlippert.com/2015/05/04/wizards-and-warriors-part...https://ericlippert.com/2015/05/07/wizards-and-warriors-part...https://ericlippert.com/2015/05/11/wizards-and-warriors-part...