34
Push Down Method
Goal
Methods used by only one subclass live with that subclass, not on the shared superclass.
Before the refactoring
class Employee {
quota() { /* used only by Salesperson */ }
}After the refactoringclass Salesperson extends Employee {
quota() { /* ... */ }
}Savings
The superclass surface shrinks; subclasses that don't need the method aren't burdened by it.
Note
If the method is occasionally needed in the parent, pushing it down forces awkward type checks back at consumers — verify usage first.