42

Remove Middle Man


Goal

Callers talk directly to the real object; trivial passthroughs are deleted.

Before the refactoring
class Manager {
  reports() { return this.team.members(); }
}
After the refactoring
// Expose team directly when the wrapper adds nothing.
manager.team.members();
Savings

Fewer files, shorter call stacks, the implementation's location is obvious.

Note

Direct access to the delegate exposes its surface to every consumer — only remove the middle man when most of its methods are passthroughs.