Skip to Content.
Sympa Menu

gang-of-4-patterns - RE: RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern

gang-of-4-patterns AT lists.siebelschool.illinois.edu

Subject: Design Patterns discussion

List archive

RE: RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern


Chronological Thread 
  • From: "Chris Finlayson" <cfinlayson AT vls-inc.com>
  • To: <gang-of-4-patterns AT cs.uiuc.edu>
  • Subject: RE: RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern
  • Date: Thu, 6 Nov 2003 10:47:17 -0700
  • Importance: Normal
  • List-archive: <http://mail.cs.uiuc.edu/pipermail/gang-of-4-patterns/>
  • List-id: Design Patterns discussion <gang-of-4-patterns.cs.uiuc.edu>

Hi all:

Thanks for all the prompt, thorough responses. It's been quite helpful.

Everyone's response has been terriffic.

I'll share one response I received that I thought was very succinct and
clear. I'll keep the author's name anonymous since he sent me his response
directly:


"A bridge sits on top of an adapter. The definition of JDBC is an
example of the Bridge pattern. The actual MySql JDBC driver would be an
example of the adapter.

Note that the intent of JDBC is to define a common API that adapters can
plug into. The overall definition of AWT, Swing or SWT are also
bridges, with the implementation on particular OS/Graphics library being
an adapter.

The bridge creates a common API and permits multiple implementations via
the Adapter pattern.

The Strategy pattern simply supports plugging in different algorithms at
run-time, as you and Gosling demonstrate with different typs of sorting.

To me, a more confusing example is State versus Strategy. I finally
decided that if I would implement it with a set of inner class, then it
was an example of the State pattern. Otherwise, it was a likely
candidate for the Strategy pattern. By that distintion, obviously, only
the one outer class can use the State inner-classes, while the Strategy
pattern can be shared between different classes."

--Chris.



> -----Original Message-----
> From:
> gang-of-4-patterns-admin AT cs.uiuc.edu
> [mailto:gang-of-4-patterns-admin AT cs.uiuc.edu]On
> Behalf Of Mikal Ziane
> Sent: Thursday, November 06, 2003 9:27 AM
> To:
> gang-of-4-patterns AT cs.uiuc.edu
> Subject: RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern
>
>
> Hi Ray and Chris,
>
> I wonder if Chris' question is not : can Bridge be seen as
> a refinement
> of Strategy in which you add subclasses to Strategy's Context ?
> In Ray's modem example the interfaces would be :
> ModemType (Context) and ModemManufacturer (Strategy).
>
> What do you think ?
>
>
> _______________________________________________
> gang-of-4-patterns mailing list
> gang-of-4-patterns AT cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/gang-of-4-patterns
>
>






Archive powered by MHonArc 2.6.16.

Top of Page