Chapter 11. Inheritance

The relationship between a class and its subclass often starts being simple but gets more complicated over time. A subclass often depends on its parent more intimately than does a separate class, but it can go too far.

A key challenge is deciding what a class is (behaves like) versus what a class has or knows. A class structure often starts with inheritance and moves to a more compositional style over time.

In this chapter we’ll cover the following smells:

Implementation Inheritance, in which subclassing is used purely to reuse code

Refused Bequest, in which a subclass isn’t substitutable for its superclass

Inappropriate Intimacy (Subclass Form), in which a subclass is tangled up in its superclass’s implementation ...

Get Refactoring in Ruby now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.