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 - Python Tutorial
From the course: Python: Advanced Design Patterns
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…
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.
Contents
-
-
-
-
-
-
(Locked)
Mediator2m 11s
-
(Locked)
Mediator example7m 29s
-
(Locked)
Memento2m 16s
-
(Locked)
Memento example4m 46s
-
(Locked)
Solution: Memento1m 43s
-
(Locked)
State2m 11s
-
(Locked)
State example5m 44s
-
(Locked)
Solution: State53s
-
(Locked)
Template method2m 17s
-
(Locked)
Template method example6m 35s
-
Solution: Template1m 14s
-
(Locked)
Practitioner's perspective: Development2m 5s
-
(Locked)
-