Home | Demos | Design Patterns | Mediator

Factory | Singleton | Strategy | Iterator | Observer | Proxy | Mediator> | Visitor

 

Mediator

See Code and log output
### **Mediator Pattern**

**Description:**
The Mediator Pattern defines an object that encapsulates how a set of objects
interact. It promotes loose coupling by preventing objects from referring to
each other explicitly and allows you to vary their interactions independently.

**How and When to Use It:**
- **When to Use:** Use the Mediator Pattern when you have a set of objects that
communicate in complex ways, and you want to simplify communication by
introducing a mediator that handles the interactions.

- **Example:** In a GUI application, a dialog box (mediator) coordinates
interactions between UI elements like buttons, text fields, and lists without
them communicating directly.