Skip to main content

What is the point of separating abstraction and implementation in the Bridge pattern?

The point of separating abstraction and implementation in the Bridge pattern is to remove the system's tight coupling between them and let both sides change independently.


1. Without Bridge: Tight Coupling

When the abstraction and the implementation are combined in a single class, any change in the way it is implemented requires a change in the abstraction as well. For example, if there are classes RemoteForTV, RemoteForRadio, AdvancedRemoteForTV, AdvancedRemoteForRadio, then adding a new device or a new remote type forces you to add new class combinations. This blows up the amount of code.


2. With Bridge: Two Independent Hierarchies

Bridge breaks that coupling:

  • The abstraction defines what the system does (for example, "Remote").
  • The implementation defines how exactly it is done (for example, "TV", "Radio").

The abstraction holds a reference to the implementation interface, not to a concrete class. Now you can freely combine: SimpleRemote + TV, AdvancedRemote + Radio, VoiceRemote + Projector, without new classes.


3. Why It Matters

  • Flexibility: the implementation (for example, a different driver or a different API) can change without changing the abstraction.
  • Scalability: it is easy to add new types of abstractions or implementations.
  • Support for the open/closed principle (OCP): new capabilities are added through extension, not rewriting.

4. Example

java
// Abstraction abstract class Remote { protected Device device; Remote(Device device) { this.device = device; } abstract void togglePower(); } // Implementation interface Device { void turnOn(); void turnOff(); } // Two independent lines of development class TV implements Device { ... } class Radio implements Device { ... } class AdvancedRemote extends Remote { ... }

Now any Device can be plugged into any Remote, without duplicating code.


5. Conclusion

Separating abstraction and implementation in the Bridge pattern removes the tight coupling between them and lets each part evolve independently. The result is a flexible, extensible, and clean architecture, where adding new devices or features does not require cascading changes.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.