From the course: Python: Advanced Design Patterns (2018)
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Mediator - Python Tutorial
From the course: Python: Advanced Design Patterns (2018)
Mediator
- 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 the design pattern community's answer to implementing this…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.