gang-of-4-patterns AT lists.siebelschool.illinois.edu
Subject: Design Patterns discussion
List archive
- From: "David Rosenstrauch" <darose AT dti.net>
- 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 13:57:25 -0500 (EST)
- List-archive: <http://mail.cs.uiuc.edu/pipermail/gang-of-4-patterns/>
- List-id: Design Patterns discussion <gang-of-4-patterns.cs.uiuc.edu>
In my mind, the defining characteristic between State and Strategy is
really intent. Superficially/structurally, yes, they look very much the
same, but they have very different intent.
Java's LayoutMangers for example would be a Strategy. There are many
different Strategies for how you can layout Components in a Container.
I can't think of a good example of the State pattern from the JDK, but the
example given in the GOF book probably expresses the intent-based
distinction well. GOF gives a communication state as an example, where
the behavior of the comm. link changes depending upon what state it's in.
The state pattern also dovetails with the concept of state machines, and
the State pattern follows from this by codifying each state as a concrete
object, along with a standardized abstract state API in order to refer to
them abstractly.
HTH,
DR
Chris Finlayson said:
>
> 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.
- [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Chris Finlayson, 11/05/2003
- Re: [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Wayne Cannon, 11/06/2003
- RE: [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Paul Adolph, 11/06/2003
- RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, ziane, 11/06/2003
- RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Paul Adolph, 11/06/2003
- RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Mikal Ziane, 11/07/2003
- RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Paul Adolph, 11/06/2003
- RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, ziane, 11/06/2003
- RE: [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Paul Adolph, 11/06/2003
- Re: [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Wayne Cannon, 11/06/2003
- <Possible follow-up(s)>
- RE: [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Ray Ye, 11/06/2003
- RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Mikal Ziane, 11/06/2003
- RE: RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Chris Finlayson, 11/06/2003
- RE: RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, David Rosenstrauch, 11/06/2003
- State and strategy [was RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern], Peter Horan, 11/06/2003
- Re: State and strategy [was RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern], Wayne Cannon, 11/06/2003
- Re: RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Wayne Cannon, 11/07/2003
- RE: RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Chris Finlayson, 11/06/2003
- RE : [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Mikal Ziane, 11/06/2003
- Re: [gang-of-4-patterns] Strategy Pattern vs. Bridge Pattern, Wayne Cannon, 11/06/2003
Archive powered by MHonArc 2.6.16.