Bridge Pattern
Bridge takes one class hierarchy that is varying along two independent axes and splits it into two hierarchies, with one holding a reference to the other. Instead of multiplying the axes into a grid of classes, you compose them at runtime. The structure is tiny; the whole difficulty is the diagnosis, because if you cannot name two axes that both actually vary, you do not have a Bridge problem.
💡 Abstraction = the hierarchy that holds the reference and owns the what and the why. Implementor = the hierarchy being held, which owns the how. The “bridge” is that one reference between them.
Why this matters: Bridge is the most misunderstood pattern in the GoF catalogue, and interviewers probe it because most candidates can draw the diagram and almost nobody can say when to reach for it. The giveaway symptom in a machine-coding round is a class name carrying two adjectives – SmsAlert, CompressedEncryptedWriter, PostgresReadOnlyRepository. Each adjective is an axis, and every new value on one axis multiplies the other. Graders watch whether you notice the multiplication before you have written nine classes, and whether you can defend not reaching for Bridge when only one axis varies.
Prerequisites
- Inheritance vs Composition – inheritance cannot express two axes without a cross product, which is the whole argument for composition here
- Strategy Pattern – structurally the same move, and telling the two apart is the question you will be asked
- Over-Engineering in LLD – Bridge is the pattern most often applied to an axis that never varies
The Problem: the notification system that multiplies
A notification system varies along two axes at once, and they are genuinely independent. The kind of notification – alert, reminder, digest – decides what the message says, how urgent it is, and how hard you should try to deliver it. The transport – SMS, email, push – decides how bytes leave the process, what the length limit is, and which failures are worth retrying. Any kind can travel over any transport, and neither axis constrains the other.
Inheritance gives you one tool for variation, so you subclass on both axes at once:
public abstract class Notification {
protected final Recipient recipient;
protected final String subject;
public abstract void send();
}
public class SmsAlert extends Notification {
private final TwilioRestClient twilio;
private final Incident incident;
@Override public void send() {
String text = "[URGENT] " + subject + " -- " + incident.summary(); // alert content rules
twilio.messages().create(recipient.phone(), text); // SMS transport
}
}
public class SmsReminder extends Notification {
private final TwilioRestClient twilio;
private final Instant dueAt;
@Override public void send() {
String text = subject + " due at " + dueAt; // reminder rules
twilio.messages().create(recipient.phone(), text); // same SMS transport
}
}
public class EmailAlert extends Notification {
private final SendGridClient sendGrid;
private final Incident incident;
@Override public void send() {
String text = "[URGENT] " + subject + " -- " + incident.summary(); // same alert rules
sendGrid.dispatch(MailMessage.builder() // email transport
.to(recipient.email()).subject(subject).html(text).build());
}
}
// ---- and the rest of the grid, every class one row paired with one column ----
public class SmsDigest extends Notification { /* digest rules + Twilio */ }
public class EmailReminder extends Notification { /* reminder rules + SendGrid */ }
public class EmailDigest extends Notification { /* digest rules + SendGrid */ }
public class PushAlert extends Notification { /* alert rules + FCM */ }
public class PushReminder extends Notification { /* reminder rules + FCM */ }
public class PushDigest extends Notification { /* digest rules + FCM */ }
Three kinds times three transports is nine classes, none of them doing two classes’ worth of work. A fourth transport costs three new classes; a fourth kind, a payment receipt, costs four. Do both and you maintain sixteen classes for seven ideas.
The arithmetic is the least of it. Three concrete things are wrong:
- The transport code is duplicated down every column.
twilio.messages().create(...)appears in three classes, and so does the phone check before it. No single class holds “how to send over SMS”, so the day you learn carrier code30001is worth retrying you have three files to edit and you will edit two. - The transport is baked into the type, so it cannot be chosen at runtime.
new SmsAlert(...)has already decided. “Alerts over push, falling back to SMS when the token is stale” would mean building aPushAlert, watching it fail, discarding it and rebuilding as anSmsAlert– with the alert’s content rules written twice. A per-user channel preference from the database is the same shape, and inheritance cannot express it at all. - Every new value on either axis edits the grid rather than one place. The transport contract is implicit, being “whatever those nine
sendmethods do”, so adding WhatsApp starts by reading three classes to reverse-engineer what a transport is. That is an open-closed violation with a multiplier on it.
Class Diagram
classDiagram
class Notification {
<<abstract>>
-MessageTransport preferred
+send() DeliveryOutcome
#assemble() Envelope
}
class AlertNotification {
-List~MessageTransport~ escalation
+send() DeliveryOutcome
}
class ReminderNotification {
-Instant dueAt
+send() DeliveryOutcome
}
class DigestNotification {
-List~Event~ events
}
class MessageTransport {
<<interface>>
+deliver(Envelope) DeliveryResult
+supports(Recipient) boolean
}
class SmsTransport {
-TwilioRestClient twilio
}
class EmailTransport {
-SendGridClient sendGrid
}
class PushTransport {
-FcmClient fcm
}
Notification <|-- AlertNotification
Notification <|-- ReminderNotification
Notification <|-- DigestNotification
Notification o-- MessageTransport : the bridge
MessageTransport <|.. SmsTransport
MessageTransport <|.. EmailTransport
MessageTransport <|.. PushTransport
The o-- edge is the bridge and the only link between the two stacks – nothing on the transport side ever names a notification kind. Note where it starts: at the abstract base, not a leaf. An SmsTransport field on AlertNotification would weld the hierarchies back together and rebuild the grid one field at a time.
Real-World Example: Multi-Channel Notification Delivery
Three kinds plus three transports is six classes rather than nine, and a fourth transport becomes one new class that every existing kind uses untouched.
// ---- Implementor side: the "how" ----
public interface MessageTransport {
DeliveryResult deliver(Envelope envelope);
boolean supports(Recipient recipient); // has this recipient an address of my kind?
String name();
}
// Envelope is a record of (recipient, subject, body, Urgency). DeliveryResult carries ok,
// a provider id, a Failure of NONE/TRANSIENT/PERMANENT/BAD_ADDRESS, and isRetryable().
public final class SmsTransport implements MessageTransport {
private static final Set<String> TRANSIENT = Set.of("20429", "30001", "30002");
private final TwilioRestClient twilio;
public SmsTransport(TwilioRestClient twilio) { this.twilio = twilio; }
@Override public DeliveryResult deliver(Envelope e) {
// Urgency arrives as data, so SMS renders it its own way; no transport ever learns
// which kind of notification produced the envelope.
String text = (e.urgency() == Urgency.HIGH ? "[URGENT] " : "") + e.subject() + " -- " + e.body();
if (text.length() > 1600) text = text.substring(0, 1597) + "..."; // carrier limit
String status = twilio.messages().create(e.recipient().phone(), text);
if (status.startsWith("sent:")) return DeliveryResult.sent(status.substring(5));
String code = status.substring(status.indexOf(':') + 1); // retryability lives here, once
return DeliveryResult.failed(
TRANSIENT.contains(code) ? Failure.TRANSIENT : Failure.PERMANENT, "twilio " + code);
}
@Override public boolean supports(Recipient r) { return r.phone() != null; }
@Override public String name() { return "sms"; }
}
// The other two are the same shape: render the Envelope the vendor's way, then classify the
// vendor's failure into Failure. Each is one class, used by every kind.
public final class EmailTransport implements MessageTransport {
private final SendGridClient sendGrid;
public EmailTransport(SendGridClient sendGrid) { this.sendGrid = sendGrid; }
@Override public DeliveryResult deliver(Envelope e) {
MailMessage m = MailMessage.builder().to(e.recipient().email()).subject(e.subject())
.priority(e.urgency() == Urgency.HIGH ? 1 : 3) // a header SMS does not have
.html(e.body().replace("\n", "<br>")).build();
try { return DeliveryResult.sent(sendGrid.dispatch(m)); }
catch (SendGridException ex) { return DeliveryResult.failed(ex.kind(), "sg " + ex.code()); }
}
@Override public boolean supports(Recipient r) { return r.email() != null; }
@Override public String name() { return "email"; }
}
public final class PushTransport implements MessageTransport {
private final FcmClient fcm;
public PushTransport(FcmClient fcm) { this.fcm = fcm; }
@Override public DeliveryResult deliver(Envelope e) {
PushAck ack = fcm.send(e.recipient().deviceToken(), Json.of("title", e.subject(),
"body", e.body(), "high", e.urgency() == Urgency.HIGH));
// A dead token is permanent for push, which is what lets an alert escalate past it.
return ack.accepted() ? DeliveryResult.sent(ack.messageId()) : DeliveryResult.failed(
ack.tokenUnregistered() ? Failure.BAD_ADDRESS : Failure.TRANSIENT, "fcm");
}
@Override public boolean supports(Recipient r) { return r.deviceToken() != null; }
@Override public String name() { return "push"; }
}
// ---- Abstraction side: the "what and why" ----
public abstract class Notification {
protected final Recipient recipient;
private final MessageTransport preferred; // the bridge, held once at the base
protected Notification(Recipient recipient, MessageTransport preferred) {
this.recipient = recipient;
this.preferred = preferred;
}
protected abstract Envelope assemble(); // each kind decides what it says, and how urgent
protected MessageTransport transport() { return preferred; }
/** Default policy: one attempt over the preferred transport. */
public DeliveryOutcome send() {
if (!preferred.supports(recipient)) return DeliveryOutcome.undeliverable(preferred.name());
return DeliveryOutcome.single(preferred.name(), preferred.deliver(assemble()));
}
}
public final class AlertNotification extends Notification {
private final Incident incident;
private final List<MessageTransport> escalation; // tried in order after the preferred one
public AlertNotification(Recipient r, MessageTransport preferred,
List<MessageTransport> escalation, Incident incident) {
super(r, preferred);
this.incident = incident;
this.escalation = List.copyOf(escalation);
}
@Override protected Envelope assemble() {
return new Envelope(recipient, "ALERT " + incident.severity() + " on " + incident.service(),
incident.summary() + "\nfiring since " + incident.startedAt(), Urgency.HIGH);
}
/** Escalate past a permanent failure, but stop on a transient one: the retry policy above
* us returns with this same transport, so escalating now would double-page. */
@Override public DeliveryOutcome send() {
Envelope envelope = assemble();
List<Attempt> attempts = new ArrayList<>();
List<MessageTransport> candidates = new ArrayList<>(List.of(transport()));
escalation.stream().filter(t -> t != transport()).forEach(candidates::add);
for (MessageTransport t : candidates) {
if (!t.supports(recipient)) { attempts.add(Attempt.skipped(t.name())); continue; }
DeliveryResult result = t.deliver(envelope);
attempts.add(Attempt.of(t.name(), result));
if (result.ok()) return DeliveryOutcome.delivered(attempts);
if (result.isRetryable()) return DeliveryOutcome.retryLater(attempts);
// permanent or bad address: this transport will never work for this alert
}
return DeliveryOutcome.exhausted(attempts);
}
}
public final class ReminderNotification extends Notification {
private final String task;
private final Instant dueAt;
private final Clock clock;
public ReminderNotification(Recipient r, MessageTransport t, String task,
Instant dueAt, Clock clock) {
super(r, t);
this.task = task; this.dueAt = dueAt; this.clock = clock;
}
@Override protected Envelope assemble() {
long left = Duration.between(clock.instant(), dueAt).toMinutes();
// Urgency is a property of the reminder, not of whatever carries it.
return new Envelope(recipient, "Reminder: " + task,
task + " is due " + (left <= 0 ? "now" : "in " + left + " min"),
left <= 15 ? Urgency.HIGH : Urgency.NORMAL);
}
/** A reminder nobody can act on is not worth sending over any transport. */
@Override public DeliveryOutcome send() {
return Duration.between(dueAt, clock.instant()).toHours() >= 1
? DeliveryOutcome.dropped("stale") : super.send();
}
}
public final class DigestNotification extends Notification {
private final List<Event> events;
private final int maxLines; // editorial choice, not a transport limit
public DigestNotification(Recipient r, MessageTransport t, List<Event> events, int maxLines) {
super(r, t);
this.events = List.copyOf(events); this.maxLines = maxLines;
}
@Override protected Envelope assemble() {
String body = events.stream().limit(maxLines).map(Event::oneLine).collect(joining("\n"));
int hidden = Math.max(0, events.size() - maxLines);
return new Envelope(recipient, "Daily digest: " + events.size(),
hidden == 0 ? body : body + "\n...and " + hidden + " more", Urgency.LOW);
}
}
// ---- The capability inheritance could not provide at all ----
Map<String, MessageTransport> transports = Map.of("sms", new SmsTransport(twilio),
"email", new EmailTransport(sendGrid), "push", new PushTransport(fcm));
// One line, no new class: the transport comes from the user's stored preference.
new ReminderNotification(user, transports.get(user.channelPreference()),
"standup", dueAt, Clock.systemUTC()).send();
// And a kind wanting several transports composes them, still without a new class.
new AlertNotification(onCall, transports.get("push"),
List.of(transports.get("sms"), transports.get("email")), incident).send();
from abc import ABC, abstractmethod
from typing import Protocol, Sequence
# Envelope, Urgency, Failure, DeliveryResult, Attempt and DeliveryOutcome match the Java tab,
# as do EmailTransport and PushTransport.
class MessageTransport(Protocol):
"""Implementor side. Structural -- no transport below inherits from this."""
name: str
def deliver(self, envelope: "Envelope") -> DeliveryResult: ...
def supports(self, recipient: "Recipient") -> bool: ...
class SmsTransport:
name = "sms"
_TRANSIENT = frozenset({"20429", "30001", "30002"})
def __init__(self, twilio: "TwilioRestClient") -> None:
self._twilio = twilio
def supports(self, recipient: "Recipient") -> bool:
return bool(recipient.phone)
def deliver(self, envelope: "Envelope") -> DeliveryResult:
# Urgency arrives as data; no transport learns which kind produced the envelope.
prefix = "[URGENT] " if envelope.urgency is Urgency.HIGH else ""
status = self._twilio.create(envelope.recipient.phone,
f"{prefix}{envelope.subject} -- {envelope.body}"[:1600])
if status.startswith("sent:"):
return DeliveryResult.sent(status[5:])
code = status.split(":", 1)[1] # retryability lives here, once
return DeliveryResult.failed(
Failure.TRANSIENT if code in self._TRANSIENT else Failure.PERMANENT, f"twilio {code}")
class Notification(ABC):
"""Abstraction side. Holds one transport; subclasses decide what to say."""
def __init__(self, recipient: "Recipient", transport: MessageTransport) -> None:
self._recipient, self._transport = recipient, transport
@abstractmethod
def _assemble(self) -> "Envelope": ...
def send(self) -> DeliveryOutcome:
if not self._transport.supports(self._recipient):
return DeliveryOutcome.undeliverable(self._transport.name)
return DeliveryOutcome.single(self._transport.name,
self._transport.deliver(self._assemble()))
class AlertNotification(Notification):
def __init__(self, recipient, transport: MessageTransport,
escalation: Sequence[MessageTransport], incident: "Incident") -> None:
super().__init__(recipient, transport)
self._incident, self._escalation = incident, tuple(escalation)
def _assemble(self) -> "Envelope":
return Envelope(self._recipient, f"ALERT on {self._incident.service}",
self._incident.summary, Urgency.HIGH)
def send(self) -> DeliveryOutcome: # escalation policy, as in the Java tab
envelope, attempts = self._assemble(), []
for transport in [self._transport, *(t for t in self._escalation
if t is not self._transport)]:
if not transport.supports(self._recipient):
attempts.append(Attempt.skipped(transport.name))
continue
result = transport.deliver(envelope)
attempts.append(Attempt.of(transport.name, result))
if result.ok:
return DeliveryOutcome.delivered(attempts)
if result.is_retryable:
return DeliveryOutcome.retry_later(attempts) # do not double-page
return DeliveryOutcome.exhausted(attempts)
# Runtime swap, which the nine-class version could not express at any price.
transports: dict[str, MessageTransport] = {"sms": SmsTransport(twilio), "push": PushTransport(fcm)}
AlertNotification(on_call, transports[user.channel_preference], [transports["sms"]], incident).send()
#include <memory>
#include <string>
#include <vector>
// Envelope, DeliveryResult, DeliveryOutcome and the three transports are as in the Java
// tab. What is C++-specific here is who owns the implementor.
class MessageTransport {
public:
virtual ~MessageTransport() = default;
virtual DeliveryResult deliver(const Envelope& envelope) = 0;
virtual bool supports(const Recipient& recipient) const = 0;
virtual std::string name() const = 0;
};
// ---- Abstraction side, owning its transport through a unique_ptr ----
// unique_ptr fits when the transport is a cheap handle built per notification. Switch to
// shared_ptr the moment one transport instance -- a connection pool, a token cache -- has
// to be shared by every notification in the process.
class Notification {
std::unique_ptr<MessageTransport> preferred_;
protected:
Recipient recipient_;
MessageTransport& transport() { return *preferred_; }
virtual Envelope assemble() const = 0;
public:
Notification(Recipient recipient, std::unique_ptr<MessageTransport> preferred)
: preferred_(std::move(preferred)), recipient_(std::move(recipient)) {}
virtual ~Notification() = default;
virtual DeliveryOutcome send() {
if (!preferred_->supports(recipient_))
return DeliveryOutcome::undeliverable(preferred_->name());
return DeliveryOutcome::single(preferred_->name(), preferred_->deliver(assemble()));
}
};
class AlertNotification : public Notification {
Incident incident_;
std::vector<std::unique_ptr<MessageTransport>> escalation_;
protected:
Envelope assemble() const override {
return Envelope{recipient_, "ALERT " + incident_.service, incident_.summary, Urgency::High};
}
public:
AlertNotification(Recipient r, std::unique_ptr<MessageTransport> preferred,
std::vector<std::unique_ptr<MessageTransport>> escalation, Incident incident)
: Notification(std::move(r), std::move(preferred)),
incident_(std::move(incident)), escalation_(std::move(escalation)) {}
// send() overrides the base to walk transport() then escalation_, stopping on a
// transient failure and escalating past a permanent one -- as in the Java tab. The
// vector owns the fallbacks, so an alert's escalation chain dies with the alert.
DeliveryOutcome send() override;
};
// ---- The C++ lineage: handle and body, better known as pimpl ----
// Same structure, different motivation. Above, the implementor exists to be swapped; in
// pimpl it exists to be hidden, so the header stops naming the implementation's types and
// its users stop recompiling when those change:
//
// class Renderer {
// class Impl; // declared here, defined only in the .cpp
// std::unique_ptr<Impl> impl_;
// public:
// Renderer();
// ~Renderer(); // out of line: Impl is incomplete here
// };
//
// One implementor, by design -- a one-implementor bridge, and fine, because what it buys
// is compile-time decoupling rather than runtime substitution.
Two things are worth saying out loud. transports.get(user.channelPreference()) is the runtime swap, one line, and the nine-class version could not do it at any price because the transport was part of the type. And AlertNotification is not a pass-through – it holds an escalation policy that reads delivery results and decides whether to move on. That matters, because a Bridge whose abstraction merely forwards its calls is indistinguishable from an Adapter, and if forwarding is all yours does, the abstraction hierarchy is not earning its existence.
Bridge is a plan; Adapter is a repair
In code these two are nearly the same object: something holding an interface and delegating. You cannot tell them apart from the shape, and interviewers know it. The difference is origin and intent.
An Adapter is written after the fact. A foreign class already exists with the wrong interface, you own one side of the mismatch, and you would never have designed it this way – it is scar tissue over a seam you did not choose. A Bridge is deliberate: you predicted two axes, you own both sides, and you chose composition over a cross product before writing the grid. So count the sides you may change – one means Adapter, two means Bridge. They also stack, since SmsTransport wraps Twilio, which makes that implementor’s body an Adapter: the Bridge is the shape of the hierarchies, the Adapter is what lives inside one leaf.
Now the honest half, because this is the pattern most often applied for nothing. If the second axis never varies – one transport, one database, one renderer, forever – you bought an interface, a class and a layer of indirection for flexibility nobody asked for. That is textbook over-engineering, and the YAGNI argument against a speculative Bridge is strong enough to present rather than hide. The precondition is evidence: both axes must have actually varied, which means you have already written the third class in one row – SmsAlert, SmsReminder, SmsDigest – and can see the grid forming. That is the Rule of Three applied to a table instead of a list.
💡 Handle and body, or pimpl in C++, is this structure with a different goal: a class holds a pointer to a hidden implementation so the header does not name that implementation’s types, cutting compile-time coupling rather than enabling substitution.
Bridge vs Adapter vs Strategy vs Abstract Factory vs State
All five are an object holding an interface. The separating question is what the interface stands in for, and who chose it when:
| Pattern | Intent | Tell |
|---|---|---|
| Bridge | Let two hierarchies vary independently and compose rather than multiply | You own both sides, and both will keep growing |
| Adapter | Make a class you cannot change fit an interface you already have | You own one side; the other is foreign and fixed |
| Strategy | Swap one algorithm inside one class | One behaviour, one context class, often picked per call |
| Abstract Factory | Create families of related objects | It returns objects instead of doing work – often it supplies a Bridge’s implementor |
| State | Change behaviour as the object’s lifecycle advances | The object swaps its own delegate, and the transitions are the design |
Be blunt about the pair that matters: Bridge and Strategy are structurally the same thing, and anyone claiming otherwise is describing intent rather than code. The distinction is scope – Strategy parameterises one behaviour inside one class, Bridge separates two whole hierarchies. Lifetime is the practical tell: a strategy is often handed in per call and replaced between calls, the way list.sort(comparator) works, whereas an implementor is chosen once at construction. If your “strategy” is used by three sibling abstractions that form a hierarchy of their own, you have built a Bridge and should call it one.
When to Use vs When to Avoid
| Use Bridge When | Avoid When |
|---|---|
| Two axes genuinely vary and you have already written the third class in one row | Only one axis varies, so the interface has exactly one implementor |
| A transport, backend or renderer must be picked at runtime from config or preference | The abstraction would only forward calls and add no policy of its own |
| Both hierarchies are yours and both will keep growing | The implementor is a single foreign SDK you cannot change – that is an Adapter |
| The platform half needs its own tests, separate from the policy half | The variation is one algorithm in one class – that is a Strategy |
| Every abstraction’s tests want the implementation replaced by a fake | The axes turn out to be dependent, so the abstraction must know what it holds |
Two failure modes, and they arrive in that order. The first is the one-implementor bridge: MessageTransport with only SmsTransport behind it buys two files, an indirection and a diagram arrow in exchange for nothing. The test is whether you can name the second implementor and point at the ticket asking for it; pimpl is the honest exception, because its payoff is compile-time and one implementor is the intent.
The second is the leaky implementor. The day AlertNotification has to write if (transport instanceof SmsTransport), the axes were never independent, and the cast is the design telling you so. The fix is not the cast, and definitely not a getUnderlyingTransport() escape hatch: either widen the interface so the thing is expressible for every implementor – supports(recipient) above is that move, and it replaced three instanceof checks – or accept that these are not two axes and collapse back toward the classes you started with. Collapsing a Bridge that does not pay scores better than defending the indirection.
Interview Questions
-
“Bridge vs Strategy?” – Scope, and refuse the version that says they differ in structure, because both are an object holding an interface and delegating. Strategy parameterises one behaviour inside one context class, often chosen per call; a Bridge’s implementor is chosen once at construction and spans the abstraction’s whole lifetime. Count abstractions – one class consuming the interface is a Strategy, three siblings with a hierarchy of their own is a Bridge.
-
“Bridge vs Adapter?” – Origin and ownership, never shape. An Adapter is a repair: the foreign class exists with the wrong interface, you own only your side, and you are matching a signature you were handed. A Bridge is a plan: you own both sides and designed them together because you predicted two axes. They compose rather than compete, since a Bridge implementor’s body is very often an Adapter around a vendor SDK.
-
“How do you know you need a Bridge before the class explosion?” – Usually you do not, and saying so is the stronger answer. On day one you have one kind and one transport, and one class is the correct call; you refactor into a Bridge at the third or fourth class, when the duplicated column is real. The exception is a prompt that hands you both lists – “SMS, email and push for alerts, reminders and digests” is a 3x3 grid stated up front, which is permission to design the Bridge immediately.
-
“What happens when a third axis appears?” – Say locale. You can compose a third hierarchy in, so the abstraction holds a transport and a
ContentFormatter, which works for three axes and starts to smell at four, because the wiring becomes the complexity you were removing. The stronger answer is that past two or three axes you no longer have classes, you have a configuration matrix: the model becomes data – a template row keyed by tenant, locale and kind – interpreted by one engine. Naming where pattern-stacking stops paying is what separates a senior answer from a catalogue recital. -
“Who creates the implementor – can the abstraction do it?” – Not if you want the pattern to work. The moment
AlertNotificationcallsnew SmsTransport(...)the hierarchies are welded together: no runtime swap, no fake in tests. It is passed in at construction, which is plain dependency injection; when implementors come in matched sets – a transport with its own rate limiter and templates – an Abstract Factory produces the set consistently.
See It in Action
- Notification Service – notification kinds on one axis, transports on the other, joined by one reference
- Logging Framework – loggers and levels against appenders for console, file and network, the textbook Bridge
- Mini ORM – the repository and query abstraction against a per-database dialect driver