Skip to Content.
Sympa Menu

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

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

Subject: Design Patterns discussion

List archive

[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: [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern
  • Date: Wed, 5 Nov 2003 15:25:37 -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>

Hello everyone,

It seems to me that the Strategy Pattern and Bridge Pattern are equivalent
both in intent and implementation, therefore I must have a
misconception....I was hoping if someone could help clarify my
understanding.

Let's focus on the application of a strategy pattern as applied to sorting.

Assume I have a few sorting algorithms that do the same thing...take in
numbers, sort, then spit out numbers. Therefore, I could have:

1. ISortStrategy - the interface to the concrete strategies
2. QuickSortStrategy - A concrete sort strategy that implements
ISortStrategy
3. MergeSortStrategy - Another concrete sort strategy that implements
ISortStrategy
etc....

Now, in the context of the program that's calling the concrete strategies,
it instantiaties an ISortStrategy (maybe via a factory with the proper
argument as to whether to use a QuickSort, MergeSort, etc.).

Now, I see this as identifical to the Bridge pattern....where the
ISortStrategy is the abstraction and the concrete sort strategies are the
implementations. What am I missing?

Thanks!

--Chris.






Archive powered by MHonArc 2.6.16.

Top of Page