0Pricing
Clean Architecture & Design Patterns in Practice · Lesson

Mediator and Chain of Responsibility

Explore two behavioral patterns that decouple senders from receivers: Mediator centralizes communication, and Chain of Responsibility passes requests along a line of handlers.

Two Ways to Decouple Communication

Objects often need to talk to each other, but direct references create tangled webs of dependencies.

This lesson covers two behavioral solutions:

  • Mediator routes all communication through a central hub.
  • Chain of Responsibility passes a request down a line until someone handles it.

The Mediator Problem

Imagine a dialog with buttons, checkboxes, and text fields all reacting to each other. If every widget references every other widget, the coupling explodes.

Mediator replaces this mesh with a star: each widget talks only to the mediator.

All lessons in this course

  1. Observer and Strategy Patterns
  2. Command and Iterator Patterns
  3. Template Method and State Patterns
  4. Mediator and Chain of Responsibility
← Back to Clean Architecture & Design Patterns in Practice