Too Long; Didn't Read
One of the benefits of object-oriented design is the ability for objects to share some behaviors while simultaneously differing in others. Typically, this is achieved through inheritance — when many subclasses inherit properties from a parent class but can optionally override certain behaviors as needed. This is a very useful and common design pattern; however, there are situations when polymorphism through inheritance is inappropriate. Consider, for example, when you only need a single behavior to change but otherwise want an object to stay the same. Or, when you want an object to shift its behavior at runtime based on some external (but unpredictable) factor. In such cases, an inheritance scheme is likely to cause unnecessarily bloated code that is difficult to maintain (particularly as the number of subtypes increases). However, there is a better approach: the <em>strategy pattern</em>.