Java Design Pattern: Bridge

In brief, Bridge Design Pattern is a two layer abstraction.

The bridge pattern is meant to "decouple an abstraction from its implementation so that the two can vary independently". The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.

1. Bridge pattern story

The example of TV and Remote Control(typo in diagram) can demonstrate the two layers of abstraction. You have an interface for TV and an abstract class for remote control. As you know, it is not a good idea to make a concrete class for either of them, because other vendors may make different implementations.

bridge design pattern

2. Bridge pattern Java code

First define a TV interface: ITV

public interface ITV {
	public void on();
	public void off();
	public void switchChannel(int channel);

Let Samsung implement ITV interface.

public class SamsungTV implements ITV {
	public void on() {
		System.out.println("Samsung is turned on.");
	public void off() {
		System.out.println("Samsung is turned off.");
	public void switchChannel(int channel) {
		System.out.println("Samsung: channel - " + channel);

Let Sony implement ITV interface.

public class SonyTV implements ITV {
	public void on() {
		System.out.println("Sony is turned on.");
	public void off() {
		System.out.println("Sony is turned off.");
	public void switchChannel(int channel) {
		System.out.println("Sony: channel - " + channel);

Remote control holds a reference to the TV.

public abstract class AbstractRemoteControl {
	 *  name="tv"
	 * @uml.associationEnd  
	private ITV tv;
	public AbstractRemoteControl(ITV tv){ = tv;
	public void turnOn(){
	public void turnOff(){;
	public void setChannel(int channel){

Define a concrete remote control class.

public class LogitechRemoteControl extends AbstractRemoteControl {
	public LogitechRemoteControl(ITV tv) {
	public void setChannelKeyboard(int channel){
		System.out.println("Logitech use keyword to set channel.");
public class Main {
	public static void main(String[] args){
		ITV tv = new SonyTV();
		LogitechRemoteControl lrc = new LogitechRemoteControl(tv);


Sony: channel - 100
Logitech use keyword to set channel.

In summary, Bridget pattern allows two layers of abstraction of implementation, in this case, TV and remote control. Therefore, it gives more flexibility.

3. Bridge pattern in Eclipse Platform

Bridge pattern is an important one used in Eclipse architecture.


1. Gamma, E, Helm, R, Johnson, R, Vlissides, J: Design Patterns, page 151. Addison-Wesley, 1995
2. Wiki Bridge Pattern

Category >> Design Patterns Stories  
If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
String foo = "bar";

  1. on 2013-10-30

    yeah,the jdbc

  2. Robin on 2013-11-13

    The class “AbstractRemoteControl“ don’t have the abstract method?

  3. Yhzhtk on 2014-6-12

    The class diagram “Remove” should be “Remote”

  4. Aleksey Grischenko on 2014-9-12

    Looks that in wiki wrong Java implementation as it uses implementor’s interface directly from abstraction refine.

  5. ajay on 2016-9-15

    I am having trouble understanding the difference between Bridge Pattern and Strategy pattern. Could you please explain it in detail with some real world practical example ?

Leave a comment