OOPsie: The Good, The Bad, The OOgly - by Matt Christian

      Posted 10/06/10 09:20:00 am  

Gamasutra reader Dustin Bennett asked the following in response to OOPsie: Individuality with Inheritance.  He suggested:

You should do a post about this line:
"Even though I mentioned this was a bad thing (creating all these inherited classes for a single property change)" and what we should do instead.

So here I am once again, to show you some of the pitfalls when it comes to OOP and how to avoid them.

Over-Inheritance

A simple pitfall many programmers fall into is over-inheritance, or overly defined class structures.  Let's look at an example using walls in Call of Duty: Modern Warfare 2.

Comments