Skip to Content.
Sympa Menu

gang-of-4-patterns - Re: [gang-of-4-patterns] discuss the usage of Strategy DP

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

Subject: Design Patterns discussion

List archive

Re: [gang-of-4-patterns] discuss the usage of Strategy DP


Chronological Thread 
  • From: Eduardo Franco <eduardo.franco AT pulso.com.br>
  • To: gang-of-4-patterns AT cs.uiuc.edu
  • Subject: Re: [gang-of-4-patterns] discuss the usage of Strategy DP
  • Date: Wed, 03 Mar 2004 07:29:20 -0300
  • List-archive: <http://mail.cs.uiuc.edu/pipermail/gang-of-4-patterns/>
  • List-id: Design Patterns discussion <gang-of-4-patterns.cs.uiuc.edu>
  • Organization: Pulso

I don't think the Strategy is the best pattern for your problem. I don't
even know much about the context your are developing the system, but
AFAICS the best suitable pattern is the "Abstract Factory".

[..]

"Provide an interface for creating families of related or dependent
objects without specifying their concrete classes."

[..]

This pattern let you vary families of product objects when the
"Strategy" pattern let you vary an algorithm which I don't think is your
real problem.

Regards,

--
Eduardo Franco

Zhai wrote:
> In a software system, we meet the following
> requirements:
> a client program, when running, have to set or get a
> parameter, named paraValue.
> But the parameter paraValue could be stored in a file
> named filePara, or in a relation
> database, such as Oracle. Now we design an abstract
> class "CParaAccess", with two
> public virtual functions setPara() and getPara() to
> set and get the parameter.
> There are two subclasses "CFileParaAccess" and
> "CDatabaseParaAccess" inherited
> from "CParaAccess", all implement setPara() and
> getPara(). However in
> "CFileParaAccess" and "CDatabaseParaAccess", the
> principle to implement
> setPara() and getPara() is different.
> In the design we can understand the client had two
> strategies to set/get the
> parameter, i.e. from a file or a database. so can we
> think our design cohere
> with the Strategy design pattern? If not, which
> pattern could we use to improve
> the design?
> thx.






Archive powered by MHonArc 2.6.16.

Top of Page