Collapse Hierarchy

Symptom

A subclass that no longer differs meaningfully from its parent — an empty subclass, or one that overrides nothing the parent didn't already do.

Goal

A subclass that no longer differs meaningfully from its parent merges back in.

Before the refactoring

class Employee {}
class FullTimeEmployee extends Employee {}

After the refactoring

class Employee {}
Example source: Illustrative example written for this site, not a quotation from any source.
Pressure

Readers navigate a hierarchy that adds no value; ceremony around construction and dispatch persists; future maintenance must touch both classes for any change.

Tradeoff

Collapsing too eagerly destroys an extension point the team will later want — only collapse when the variant has been zero-sum for a sustained period.

Relief

Smaller hierarchy, less ceremony, fewer files to navigate.

Trap

Collapsing a hierarchy whose subclass is currently quiet but documents a real future variation — destroys an extension point the team will need to re-introduce later at higher cost.