Now, we will now get to know the Mediator Design Pattern.
The Mediator Pattern defines an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently. Rather than interacting directly with each other, objects ask the Mediator to interact on their behalf which results in reusability and loose coupling
Via a real life example, you will learn how and when the Mediator design pattern should be used and how to structure your code in order to implement it. You will see how it can lead to elegant solutions to code problems.