The middle man is a class that has several methods which act as passthrough ๐ methods (they simply delegate the call to a method of one of the class' dependencies), without adding โโ any meaningful logic on top of it.
Why is it bad? ๐
This pattern adds virtually no value โ๐ฐ to the code, but it introduces additional sources of coupling ๐ since we are calling methods between multiple interfaces, and often fooling ourselves that we are following the information-hiding ๐ principle (if the methods of a class are calling other methods of another class, is this really information hiding? ๐ค)
Generally, encapsulation and information hiding ๐ are highly encouraged ๐, but when methods become too shallow โ๐ช, it's a sign that we are not properly structuring our code.
How to fix it? ๐ก
If there is no additional logic, remove ๐งน as many intermediate as possible. Keep in mind ๐ง the separation between layers (if however, layers are existing just to pass methods to lower-level layers, the system architecture probably needs some rework).
Combine methods and simplify ๐ the class interface to provide more functionality through fewer methods.