Mediator Pattern
Learn Mediator Pattern (Behavioral Patterns, Design Patterns in Java) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Mediator Pattern defines an object that coordinates communication between a group of other objects, so they don't talk to each other directly. Real-Life Example: Air Traffic Control Tower — planes don't talk to each other directly, tower coordinates them Chat Room — users send messages through a mediator, not directly to every other user Airport Ground Staff Coordination Why do we need it? Without a mediator, every object needs a reference to every other object (many-to-many mess) Mediator centralizes communication logic in one place Reduces tight coupling between components Basic Structure:...