Is the bridge pattern the same as the vendor pattern?

Whether the bridge pattern is the same as the vendor pattern. I have not seen the vendor pattern listed in the GoF book

+1


a source to share


3 answers


Maybe the difference is that the vendor pattern could potentially encapsulate many bridges?

I also ask myself the same question and can hardly see the difference.

I see the vendor template as the main strategy template.



A question that can help and clear my confusion

When do you use the bridge pattern? How is this different from the adapter pattern?

IE yes, they are similar in the examples, but their purpose is different.

+1


a source


I'd say they are "very similar", consider the Steven Metzker Design Patterns in C #: it provides an implementation of the Bridge Pattern for Database Drivers on page 71. When I read it, it looks like a fancy vendor pattern.



0


a source


Not familiar with vendor pattern. The purpose of the Bridge pattern is to decouple abstractions from their respective implementations. Simplified code for example:

class Abstraction
{
  IBridge _bridge;
  public Abstraction(IBridge implementation) { _bridge=implementation; }
  public DoStuff() { _bridge.DoStuff(); }
}

interface IBridge
{
  void DoStuff();
}

class BridgeA : IBridge
{
  void DoStuff() {...}
}

class BridgeB : IBridge
{
  void DoStuff() {...}
}

      

0


a source







All Articles