Middle Man

MiddleMan is a CodeSmell.

A MiddleMan is a class that delegates most of its work to other classes. A MiddleMan is a class that is doing too much simple delegation instead of really contributing to the application.

MiddleMan can often be removed and their functionality placed in the classes that they were mediating.

Hmm. How does this relate to MediatorPattern and FacadePattern?

MiddleMan is not a code smell with the MediatorPattern and FacadePattern when one of these patterns is used to provide a choke point for a particular aspect. One might call this poor man's AspectOrientedProgramming. If the mediator or facade does not do anything much then it probably is a smell. The reason I mention this particular case is that Aspects often are invisible to the functionality of the program and merely cover sort of a side aspect, so the program behaves like one of these patterns is merely a MiddleMan, but in reality it is not. The code stops smelling once you use the MiddleMan to implement an aspect.


EditText of this page (last edited April 19, 2013) or FindPage with title or text search