concept

Mediator Pattern

The Mediator Pattern is a behavioral design pattern that defines an object (the mediator) that encapsulates how a set of objects interact, promoting loose coupling by preventing objects from referring to each other explicitly. It centralizes complex communications and control logic between related objects, making the system easier to understand and maintain by reducing direct dependencies. This pattern is commonly used in GUI applications, chat systems, and air traffic control to manage interactions between multiple components.

Also known as: Mediator, Mediator Design Pattern, Intermediary Pattern, Controller Pattern, Coordinator Pattern
🧊Why learn Mediator Pattern?

Developers should use the Mediator Pattern when they have a set of objects that communicate in complex ways, leading to tight coupling and hard-to-maintain code; it simplifies interactions by centralizing control in a mediator object, making the system more modular and easier to extend or modify. Specific use cases include implementing chat rooms where users send messages through a central server, managing UI components in applications to avoid direct event handling between widgets, and coordinating subsystems in large-scale software like gaming or simulation environments.

Compare Mediator Pattern

Learning Resources

Related Tools

Alternatives to Mediator Pattern