Middle Man: What It Costs and How to Fix It
A class that delegates most of its work to another class, adding an unnecessary layer of indirection.
What It Is
A Middle Man is a class whose methods do little more than call methods on another class. It exists as an intermediary that adds no value: it does not transform data, validate inputs, or add behaviour. Middle Men often arise from over-application of the Hide Delegate refactoring (meant to fix Message Chains) or from architectural layers that were added 'for flexibility' but never justified their existence. The result is a class that developers must navigate through to reach the real implementation.
Why It Costs Money
Every interaction requires an extra hop. Developers navigating the codebase must open the Middle Man, see that it delegates, and then navigate to the real class. This adds friction to every debugging session and code review.
Changes require updating two classes. When the delegate's interface changes, the Middle Man must be updated to match, even though it adds no logic. This doubles the mechanical effort of interface changes.
The Middle Man obscures the real architecture. New developers cannot tell from the call site which class actually does the work. They must trace through the Middle Man to find the implementation, adding to onboarding time.
Specific Cost Mechanisms
- ●Navigation overhead: extra file to open and understand for every interaction
- ●Double maintenance: interface changes require updating both the Middle Man and the delegate
- ●Architectural confusion: the real responsibility owner is hidden behind a passthrough layer
Estimated Annual Cost
Cost per instance by team size and codebase size. Based on $120,000 average developer salary. See full methodology.
| Team Size | Small (<50k LOC) | Medium (50k-200k) | Large (200k+) |
|---|---|---|---|
| 3 devs | $800 | $1,800 | $3,600 |
| 5 devs | $1,300 | $3,000 | $6,000 |
| 10 devs | $2,000 | $4,500 | $6,000 |
| 20 devs | $2,600 | $6,000 | $6,000 |
How to Detect It
Specific rules and thresholds for automated detection. See full tool comparison.
Methods that only call another method with the same parameters
Very short methods that only delegate
Indirect indicators of passthrough methods
If > 50% of methods simply delegate, the class is a Middle Man
Refactoring Patterns
Proven techniques to eliminate this smell. See all refactoring patterns.
Remove Middle Man
The class adds no logic, validation, or transformation
Inline Class
The Middle Man and its delegate should be a single class
Replace Delegation with Inheritance
The Middle Man genuinely specialises the delegate (rare)