Why this matters
Inheritance is a strong coupling tool. When a class varies along two independent dimensions — say, type of remote control and type of device — modeling both in one hierarchy produces M × N subclasses. Bridge separates the two dimensions: the abstraction (RemoteControl) holds a reference to the implementation (Device) and delegates to it. Adding a new remote or a new device is a single new class, not N or M.
La herencia es una herramienta de acoplamiento fuerte. Cuando una clase varía en dos dimensiones independientes — como el tipo de control remoto y el tipo de dispositivo — modelar ambas en una jerarquía produce M × N subclases. Bridge separa las dos dimensiones: la abstracción (RemoteControl) mantiene una referencia a la implementación (Device) y delega en ella. Agregar un nuevo control o un nuevo dispositivo es una sola clase nueva, no N o M.
Composition over inheritanceComposición sobre herencia
Bridge is one of the clearest examples of favouring composition over inheritance. The remote has a device rather than being a kind of device. This lets you swap the device at runtime — pass a different implementation to the same abstraction constructor without touching any subclass. The same principle appears in JDBC (the SQL API is the abstraction; the driver is the implementation) and in graphics libraries that separate shape logic from rendering backends.
Bridge es uno de los ejemplos más claros de preferir la composición sobre la herencia. El control remoto tiene un dispositivo en lugar de ser un tipo de dispositivo. Esto permite intercambiar el dispositivo en tiempo de ejecución — pasas una implementación diferente al mismo constructor de abstracción sin tocar ninguna subclase. El mismo principio aparece en JDBC (la API SQL es la abstracción; el driver es la implementación) y en bibliotecas gráficas que separan la lógica de formas de los backends de renderizado.
💡 Key takeaway
If you have M abstractions × N implementations, Bridge prevents M×N classes by composing them — add new remotes or devices independently.
Si tienes M abstracciones × N implementaciones, Bridge previene M×N clases combinándolas — añade controles o dispositivos nuevos de forma independiente.