Introduction
Mediator pattern is a very well-known pattern in programming, and in this post, we will see what it is, what it brings to the table. A straightforward implementation to understand some of the situations where we can think of using it.
- A mediator pattern encapsulates how objects interact and communicate with each other.
- It promotes loose coupling of objects.
- It facilitates many-to-many relationships/communication as well as one-to-many.
- You can think of Mediator as a communication hub.
Examples
You can use a mediator pattern for many different use-cases. Following are a few of the requirements/situations where the Mediator pattern can help us greatly.