Bridge Design Pattern – Initial Concept
This springcavaj – Structural Design Pattern page briefly describes the Initial Concept of Structural Design Patterns, advantages, disadvantages, benefits, various types, common problems, and a few interview questions discussed.
This guide provides a comprehensive understanding of Structural Design Patterns for designing and architecting an application.
What is a Bridge Design Pattern
The Bridge Pattern is a Structural Design Pattern that decouples abstraction from implementation, allowing the two to vary independently.
It is used when you want to separate a class’s interface from its implementation, allowing both to evolve independently without breaking each other.
Example – Think of a remote control (abstraction) and TVs (implementations). You should be able to use the same remote with multiple TV brands (Samsung and Sony) without needing to rewrite the remote.
What are the features of the Bridge Design Pattern?
- Decoupling – Separates the abstraction and its implementations.
- Composition over Inheritance – Encourages using composition instead of a deep inheritance tree.
- Flexibility – One can change or extend either abstraction or implementation without affecting the other.
- Scalability – It supports scalable systems with multiple hierarchies.
What are the advantages of the Bridge Design Pattern?
- Code Duplication – Reduces Code Duplication across hierarchies.
- Supports Open/Close Principle – Abstraction and implementation can be extended independently.
- Flexible – New functionalities can be added without changing the existing code.
- Maintainability – Improves maintainability by separating concerns.
What are the disadvantages of the Bridge Design Pattern?
- Increased Complexity – Adds extra layers to the code.
- Too abstract for small projects – Complicated for simple use cases.
- Overhead – May cause a performance hit due to delegation.
What are the use cases of the Bridge Design Pattern?
- Cross-platform UI rendering – Separate UI abstraction from underlying OS implementations.
- Multi-database ORM – Support different databases behind a common interface.
- Device Control Systems – One interface controls many devices with different protocols.
- Game Engines – Abstraction for different graphics APIs (Vulkan, DirectX, OpenGL).
Brief Description of Implementation
I have developed a small program to help you understand the working principle of the Bridge Design Pattern. The code is uploaded to GitHub as springcavaj-designpattern repository. Please clone the application and import it into any of the IDs, like either STS or Eclipse.
After successfully importing the above code base, one will find a class named BridgeMasterclassApplication.java in the com.springcavaj.designpattern.bridge package. Please see the screenshot attached below.

Here you can see the class under the com.springcavaj.designpattern.bridge package is BridgeMasterclassApplication.java. Right-click on the class, select the Run As option, and then Java Application. It will run and generate the output as provided below.
INFO com.springcavaj.designpattern.bridge.BridgeMasterclassApplication - Computuation for Circle 1 Object
INFO com.springcavaj.designpattern.bridge.design.impl.OpenGL - OpenGL: Drawing circle at (3.0 and 12.0) with radius 3.0
INFO com.springcavaj.designpattern.bridge.BridgeMasterclassApplication - Computation for Circle 2 Object
INFO com.springcavaj.designpattern.bridge.design.impl.DirectX - DirectX: Drawing circle at (6.0 and 24.0) with radius 6.0
Detailed Explanation
As we know, the Bridge Design Pattern decouples abstraction from its implementations. I have followed the same strategy and will explain that strategy. Here, the use case is to draw a Circle using different Drawing APIs. In this case, I have used 2 drawing APIs as DirectX & OpenGL. You can use other drawing APIs as well.
So, for that, I have defined an interface for drawing APU as Drawing.
public interface Drawing {
void drawCircle(double x, double y, double radius);
}
Here you can see that there is one method named drawCircle(double x, double y, double radius). This is the interface for the implementation part of the pattern.
Now, 2 APIs, OpenGL and DirectX, are the 2 implementation classes of the Drawing API Interface.
DirectX.java
public class DirectX implements Drawing {
private static final Logger LOGGER = LoggerFactory.getLogger(DirectX.class);
@Override
public void drawCircle(double x, double y, double radius) {
LOGGER.info("DirectX: Drawing circle at ({} and {}) with radius {}", x, y ,radius);
}
}
OpenGL.java
public class OpenGL implements Drawing {
private static final Logger LOGGER = LoggerFactory.getLogger(OpenGL.class);
@Override
public void drawCircle(double x, double y, double radius) {
LOGGER.info("OpenGL: Drawing circle at ({} and {}) with radius {}", x, y ,radius);
}
}
These classes implement the Drawing Interface and provide different drawing implementations.
Now the Abstraction layer.
Shape.java is the abstract class that holds a reference to the Drawing API interface, which allows for decoupling the abstraction from how it is rendered (implementation).
public abstract class Shape {
protected Drawing drawing;
protected Shape(Drawing drawing) {
this.drawing = drawing;
}
public abstract void draw();
}
Circle.java is the concrete implementation of the abstract class Shape. It adds its data (x, y, radius). Now, when .draw() method is called, it delegates the drawing task to the Drawing API.
public class Circle extends Shape {
private double x, y, radius;
public Circle(double x, double y, double radius, Drawing drawing) {
super(drawing);
this.x = x;
this.y = y;
this.radius = radius;
}
@Override
public void draw() {
drawing.drawCircle(x, y, radius);
}
}
Now, there is a client class named BridgeMasterclassApplication.java, which creates 2 objects of Circle but using 2 different drawing APIs (DirectX & OpenGL).
Steps to run the application
The complete Run application steps are provided in this README.md file, but still, I am still providing the steps to run points below.
- Clone the sprincavaj-designpattern application from the GitHub repository.
- Import the application as a Maven application, either in STS or Eclipse.
- Find the BridgeMasterclassApplication.java class.
- Right-click on the file and select Run As -> Java Application.
GitHub Code Link
Download the Source Code from GitHub
Common Problems Faced in Implementing the Bridge Pattern
Bridge Design Pattern Common Problems
Interview FAQs
Bridge Design Pattern Interview FAQs
Other Useful Links
Implementations of various components of Spring Boot
Other Design Pattern Links
Creational Design Patterns
Abstract Factory Design Pattern