Software Design

Mediator Pattern: Decoupling Chat Rooms

UML Class Diagrams · made in Skemio

UML class diagram of Mediator Pattern showing ChatMediator interface, ChatRoom implementation, User abstract class, and ChatUser class.
UML class diagram of Mediator Pattern showing ChatMediator interface, ChatRoom implementation, User abstract class, and ChatUser class.

What it shows

  • Replaces O(N^2) peer connections with O(N) links to a single mediator hub.
  • Colleagues stay loosely coupled; they only send events to the mediator.
  • Centralizes routing, rate limiting, and message logging in one place.

The takeaway

Turn messy peer-to-peer meshes into clean hubs by routing interactions through a Mediator.

More uml class diagrams