The mediator design pattern is used to permit object interactions without using explicit object references. This is an advanced use of the object-oriented programming encapsulation concept. Mediators manage the interactions between two or more objects. A real-world example is a legal mediator where both sides of a lawsuit communicate to the mediator, but not directly to each other.
We will look at an example use case, the UML class diagram, and the source code necessary to implement the mediator design pattern for this scenario.