64

Push Down Field


Goal

A field used by only one subclass moves out of the parent and into that subclass.

Before the refactoring
class Employee {
  quota; // only Salesperson uses this
}
After the refactoring
class Employee {}
class Salesperson extends Employee { quota; }
Savings

Other subclasses no longer carry storage they ignore; the parent's surface shrinks; the field's meaning becomes local.

Note

If the field is occasionally consulted in the parent for type checks, pushing it down forces awkward downcasts — verify usage first.