In what scenarios would you use the Bridge pattern?

The Bridge pattern fits scenarios where a system has two independent dimensions of variation — such as an abstraction and its underlying implementation — that both need to change or extend over time without forcing changes on each other.

Key Points

Example

A cross-platform GUI toolkit can separate a Window abstraction from platform-specific WindowImpl implementations for Windows, macOS, and Linux, so adding support for a new OS only means adding a new implementation class, not touching the Window abstraction hierarchy.

public class WindowBridge {

    // Implementor: one class per operating system
    interface WindowImpl { void drawFrame(String title); }
    static class WindowsImpl implements WindowImpl { public void drawFrame(String t) { System.out.println("[Win32] " + t); } }
    static class MacImpl implements WindowImpl { public void drawFrame(String t) { System.out.println("[Cocoa] " + t); } }
    static class LinuxImpl implements WindowImpl { public void drawFrame(String t) { System.out.println("[GTK] " + t); } }

    // Abstraction: kinds of windows, independent of the OS
    static class Window {
        protected final WindowImpl impl;
        Window(WindowImpl impl) { this.impl = impl; }
        void open(String title) { impl.drawFrame(title); }
    }

    static class DialogWindow extends Window {
        DialogWindow(WindowImpl impl) { super(impl); }
        @Override void open(String title) { impl.drawFrame("Dialog: " + title); }
    }

    public static void main(String[] args) {
        new Window(new LinuxImpl()).open("Editor");
        new DialogWindow(new MacImpl()).open("Save changes?");
        new DialogWindow(new WindowsImpl()).open("Save changes?");
    }
}

Output

[GTK] Editor

[Cocoa] Dialog: Save changes?

[Win32] Dialog: Save changes?

Interview Tip

A concise interview answer is

I'd reach for Bridge whenever there are two independent axes of variation — like an abstraction and a platform-specific implementation — that both need to evolve separately, such as a cross-platform GUI toolkit where I want to add new operating systems without touching the shared GUI abstraction code.

Last updated: 1 November 2026

Previous question: How would you implement the Bridge pattern in Java?

Next question: What are the key benefits of using the Bridge pattern in large systems?

More Java Design Patterns interview questions

All Java Design Patterns questions