Out of all the design patterns, the Mediator pattern has probably been reinvented more times than any other.
It is an absolutely essential pattern any time you have many different components of a system which have to maintain a consistent
state as a whole. It is used by any system in which many different parts must work together efficiently while sharing the same
We are going to use the Mediator pattern to manage the traffic lights in our traffic system.
The SlideShow below illustrates the motivation of the Mediator pattern specific to our project:
Alternative Images to the SlideShow.
Traffic Light Mediator Gallery
As you add more complicated intersections with turn signals, turning lanes, and more, the complexity grows.
You need a way of untangling all these connections. The Mediator pattern provides it.