Questions tagged [bridge]

A design pattern that decouples an abstraction from its implementation so that the two can vary independently. One of the Gang of Four's structural design patterns.

The Bridge pattern is a design pattern used in software engineering which is meant to "decouple an abstraction from its implementation so that the two can vary independently". Bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.

This is one of the Gang of Four's structural , first published in Gamma et al.'s book "Design Patterns: Elements of Reusable Object-Oriented Software".

More information is available on Wikipedia.

Bridge Design Pattern on SourceMaking

Bridge Design Pattern on GeeksForGeeks

Bridge Design Pattern example video

455 questions
464
votes
13 answers

How do the Proxy, Decorator, Adapter, and Bridge Patterns differ?

I was looking at the Proxy Pattern, and to me it seems an awful lot like the Decorator, Adapter, and Bridge patterns. Am I misunderstanding something? What's the difference? Why would I use the Proxy pattern versus the others? How have you used them…
Charles Graham
  • 24,293
  • 14
  • 43
  • 56
171
votes
13 answers

When to use the Bridge pattern and how is it different from the Adapter pattern?

Has anyone ever used the Bridge pattern in a real world application? If so, how did you use it? Is it me, or is it just the Adapter pattern with a little dependency injection thrown into the mix? Does it really deserve its own pattern?
Charles Graham
  • 24,293
  • 14
  • 43
  • 56
171
votes
11 answers

Difference between Bridge pattern and Adapter pattern

What is the difference between the Bridge and Adapter patterns?
Firoz
  • 7,224
  • 10
  • 41
  • 56
136
votes
15 answers

What is the difference between the bridge pattern and the strategy pattern?

I tried to read many articles on dofactory, wikipedia and many sites. I have no idea on differences between bridge pattern and the strategy pattern. I know both of them decouple an abstraction from its implementation and can change implementation…
Krirk
  • 1,466
  • 2
  • 10
  • 10
40
votes
9 answers

Strategy vs. Bridge Patterns

I know this question's been asked before (e.g., What is the difference between the bridge pattern and the strategy pattern?). However, could someone please explain, using clear-cut examples, what the difference is and in what sorts of cases one must…
S. Valmont
  • 403
  • 1
  • 4
  • 4
22
votes
3 answers

Bridge vs. Adapter Design Pattern

I was questioned by a colleague about the design pattern of my implementation of a WCF windows service in a ASP.net client application and I really could not tell whether it is Bridge or Adapter! Here is the implementation: I have obtained the…
Kamyar Nazeri
  • 25,786
  • 15
  • 50
  • 87
19
votes
3 answers

Does the Bridge Pattern decouples an abstraction from implementation?

I learned Bridge pattern from different articles and I have implemented that as per my understanding . One thing that is confusing me is bridge pattern says BridgePattern decouples an abstraction from its implementation so that the two can vary…
Ali
  • 557
  • 1
  • 9
  • 30
14
votes
2 answers

How to write react native "native module" ( bridge ) that reuses common JavaScript code?

How can a native module callback to a JavaScript internal bridge method, then do processing in the internal method, for example parsing data into JSON, and then raise an event that the react native app receives? For cross-platform bridge modules, I…
Ed of the Mountain
  • 5,219
  • 4
  • 46
  • 54
13
votes
4 answers

bridge pattern vs. decorator pattern

Can anybody elaborate the Bridge design pattern and the Decorator pattern for me. I found it similar in some way. I don't know how to distinguish it? My understanding is that in Bridge, it separate the implementation from the interface, generally…
skydoor
  • 25,218
  • 52
  • 147
  • 201
12
votes
3 answers

AbstractFactory Versus Bridge Pattern

I have just learned the Bridge Pattern and its intent : Decouple an abstraction from its implementation so that the two can vary independently. But why couldn't just an AbstractFactory do the same thing ? I know that an AbstractFactory can create a…
Mik378
  • 21,881
  • 15
  • 82
  • 180
12
votes
3 answers

Difference between log4j-to-slf4j and log4j-over-slf4j

I dont really get the difference between log4j-to-slf4j.jar and log4j-over-slf4j.jar. From what I read on the internet log4j-to-slf4j.jar: (https://logging.apache.org/log4j/2.x/log4j-to-slf4j/index.html) "The Log4j 2 to SLF4J Adapter allows…
Splioo
  • 370
  • 3
  • 11
12
votes
4 answers

Docker: how to connect two bridges

As you know after Docker 1.9 we can create bridges to connect containers. I have created two custom bridges: bridge A 172.18.0.1 and bridge B 172.19.0.1. Now I have a container1 on bridge A, and a container2 on bridge B called "mailServer". The…
hawarden_
  • 1,904
  • 5
  • 28
  • 48
12
votes
9 answers

docker: how to get veth bridge interface pair easily?

i have 2 containers by docker, and bridge like this: # docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ef99087167cb …
user3300984
  • 121
  • 1
  • 1
  • 3
11
votes
2 answers

Bridge Network on Docker vs Bridged Network on VMWare/VirtualBox seems to be very different. Why?

TL;DR - Why does Docker call it's default networking as Bridge Networking when it seems to be a lot like NAT Network. Let start by looking at how - 1) VMWare or VirtualBox handles networking for virtual machines. Say the Host IP is some random…
samshers
  • 1
  • 6
  • 37
  • 84
11
votes
2 answers

Bridge- vs Strategy-Pattern

I know, this question was asked many times, but I did some research and still don't get it, probably you can help me out: As stated many times, the UML is almost the same. Also the implementation and idea is more or less the same: Instead of…
Matthias Müller
  • 3,336
  • 3
  • 33
  • 65
1
2 3
30 31