Behavioral

Mediator

Description

Lets you reduce chaotic dependencies between objects. The pattern restricts direct communications between the objects and forces them to collaborate only via a mediator object.

Where to use

  • Chat rooms.
  • \n
  • GUI forms with complex interactions.

Real World Example

Air Traffic Control. Planes don't talk to each other; they talk to the Tower, which coordinates them.

Code Example

class Mediator:\n    def __init__(self):\n        pass\n\n    def execute(self):\n        print('Executing Mediator')