From the course: Python: Advanced Design Patterns

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Mediator

Mediator

- [Instructor] Imagine a busy airport, where airplanes are waiting, and moving on various runways. Pilots can talk to each other, and try to figure out how to avoid collisions on their own, but this will be an impossible task, due to the complexity of the problem, as well as their inability to see the big picture. This is why we need a mediator, such as an air traffic controller, to centrally and effectively manage the communication among individual pilots. A similar scenario can occur in programming. When there are too many objects interacting with each other individually, the complexity of the code can increase dramatically, and its maintainability also decreases. In particular, a simple change in one object can have a huge ripple effect on the rest of the code. We call this phenomenon "tight coupling among objects." A logical solution to this problem, is creating and designating an object as a mediator for other objects. The mediator pattern is a design pattern community's answer…

Contents