Pull Up Field

Removes smells
Symptom

A field declared identically in two or more subclasses — every subclass has `_name` with the same type, default, and visibility.

Goal

A field declared identically in two or more subclasses moves to the shared superclass.

Before the refactoring

class Manager extends Employee { _name; }
class Engineer extends Employee { _name; }

After the refactoring

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

The shared field's type and default are duplicated; refactoring its shape means touching every subclass; the field's true ownership is muddy.

Tradeoff

Pulling up a field that subclasses use differently (different default, different visibility) creates surprise — verify the field semantics are identical.

Relief

One canonical declaration of the field's type and default; subclasses focus on what they actually specialize.

Trap

Pulling up a field that subclasses use differently — different defaults, different visibility, different semantic role — creates surprises where the shared declaration masks divergent uses.