Mediator
Description
A mediator is a central hub that coordinates interactions among a set of components that would otherwise need to know about each other directly. By interposing itself, the mediator reduces the N²-edge problem (every peer knows every other peer) to N spokes (every peer knows only the mediator). The peers become loosely coupled; the mediator absorbs the coordination logic that would otherwise be smeared across the peers’ interaction edges. The structural commitment is centralization. The mediator is a single point of coordination — and, by construction, a single point of failure, contention, and policy. That centralization buys clean decoupling of peers, easier evolution of coordination logic (change one node, not N), and a clear place to enforce cross-cutting rules. It costs scalability beyond the mediator’s capacity, complexity at the mediator (which can become a “god node”), and a hub failure that takes down all interactions. The dual to mediator is multi-hop-routing: distribute the coordination across the peers; each peer knows only its neighbor. Mediator and multi-hop-routing are the two endpoints of a spectrum about how to organize coordination — central authority vs. distributed knowledge.Triggers
User-initiated: User describes wanting to introduce a “hub” or “coordinator” or “central place” for components that currently know about each other in a tangled web. Vocabulary cues: “hub,” “central,” “coordinator,” “broker,” “bus,” “switchboard,” “router,” “orchestrator.” Agent-initiated: Agent notices N components with N² edges of direct knowledge of each other, and that coordination logic is being implemented redundantly at multiple endpoints. Candidate inference: “introduce a mediator; peers communicate only through it; consolidate the coordination logic.” Situation-shape signals: N²-tangle of mutual references. Cross-cutting coordination rules (ordering, conflict resolution, fan-out) implemented inconsistently across peers. A “god class” forming organically because everyone needs to talk through it — that organic god class is a mediator that wants to be named and designed properly.Exclusions
- Two peers only — mediator’s value comes from reducing N² to N; for N=2 the indirection is overhead with no payoff.
- Hub becomes a god class — when the mediator’s responsibilities expand uncontrollably (every cross-cutting concern accretes there), the mediator becomes the system’s single biggest source of complexity. Either rein the mediator’s scope or replace with a distributed coordination scheme.
- Latency budgets can’t afford the hop — every peer-to-peer communication now requires a round-trip through the mediator; in latency-sensitive contexts (high-frequency trading, real-time control), the hop cost can be prohibitive.
- Mediator is a single point of failure with no redundancy plan — centralization without HA / redundancy means every outage is total.
- Coordination logic is genuinely local — if “coordination” really only happens between peer A and peer B, with no broader policy, putting it in a mediator just adds indirection without consolidation.
Structure
Relationships
- bottleneck-buffer — mediators are bottlenecks; every coordination is a bottleneck-buffer pair (the mediator + its queues). Designing for mediator scaling means designing the bottleneck-buffer pair deliberately.
- observer — many practical “mediator + observer” systems are message buses: the bus is the mediator, observers subscribe to the bus. The two primitives compose into the modern event-bus architecture.
- multi-channel-ingest — mediators often sit at the converging point of multi-channel-ingest; each channel is a peer, the mediator is where they meet.
- active-gate-vs-passive-audit — mediators are natural sites for active gates; centralized coordination means centralized enforcement of validation, authorization, and policy.
- load-bearing — the mediator becomes the most load-bearing piece in any system that uses it; auditing the mediator is the highest-leverage audit in such a system.
Examples
Air traffic control · transportation
Air traffic control · transportation
Conference moderators · journalism-media-studies-and-communication
Conference moderators · journalism-media-studies-and-communication
Gamma, Helm, Johnson, Vlissides (1994), Design Patterns: Elements of Reusable Object-Oriented Software (Gang of Four). Behavioral pattern, ch. 5. · computer-science
Gamma, Helm, Johnson, Vlissides (1994), Design Patterns: Elements of Reusable Object-Oriented Software (Gang of Four). Behavioral pattern, ch. 5. · computer-science
Matchmakers / dating apps · computer-science
Matchmakers / dating apps · computer-science
Message-bus / event-bus literature (Hohpe & Woolf 2003, *Enterprise Integration Patterns*). · computer-science
Message-bus / event-bus literature (Hohpe & Woolf 2003, *Enterprise Integration Patterns*). · computer-science
Redux store · computer-science
Redux store · computer-science
Reservation systems · computer-science
Reservation systems · computer-science
Telephone switchboard operators (early 20th century) — the structural ancestor; one operator at the center coordinating connections among many callers · engineering-and-technology
Telephone switchboard operators (early 20th century) — the structural ancestor; one operator at the center coordinating connections among many callers · engineering-and-technology
Workflow engines (Airflow, Temporal) · computer-science
Workflow engines (Airflow, Temporal) · computer-science