Skip to Content.
Sympa Menu

gang-of-4-patterns - RE : [gang-of-4-patterns] Prototype and Composite/Decorator and Builder for Composite

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

Subject: Design Patterns discussion

List archive

RE : [gang-of-4-patterns] Prototype and Composite/Decorator and Builder for Composite


Chronological Thread 
  • From: "Mikal Ziane" <Mikal.Ziane AT lip6.fr>
  • To: "'Yves Roy'" <yvesroy_ AT sympatico.ca>, <gang-of-4-patterns AT cs.uiuc.edu>, <patterns-discussion AT cs.uiuc.edu>
  • Subject: RE : [gang-of-4-patterns] Prototype and Composite/Decorator and Builder for Composite
  • Date: Wed, 28 May 2003 19:13:02 +0200
  • 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>

I guess that if class Client wants to use some methods of classes A1... An
uniformly (hypothesis of Composite) then it is natural that class Client use
"new" uniformly too and hence rely on Prototype.

It is not necessary if the goal is simply to use specific methods uniformly
(e.g. "draw") to hide the loop involved by calling the method on parts of a
composite (e.g. drawing a figure involves drawing its parts).

But if the goal is to decouple class Client from the existence of classes A1
... An (which implies using all their operations uniformly including "new")
then a creational pattern like Prototype of Factory Method is useful if not
necessary.

-----Message d'origine-----
De :
gang-of-4-patterns-admin AT cs.uiuc.edu
[mailto:gang-of-4-patterns-admin AT cs.uiuc.edu]
De la part de Yves Roy
Envoyé : mercredi 28 mai 2003 19:25
À :
gang-of-4-patterns AT cs.uiuc.edu;

patterns-discussion AT cs.uiuc.edu
Objet : [gang-of-4-patterns] Prototype and Composite/Decorator and Builder
for Composite

Dear suscribers:

I have 2 clear and simple questions:

1) The GOF book mentions in the Related Patterns section of Prototype
pattern (p. 126) that "Design that make heavy use of the Composite and
Decorator patterns often can benefit from Prototype as well".

My question is, how, exactly? Any simple C++ examples illustrating would
be welcome.
tinfo/gang-of-4-patterns






Archive powered by MHonArc 2.6.16.

Top of Page