S
Steven T. Hatton
"Reduced subclassing. Factory Method (107) often produces a hierarchy of
Creator classes that parallels the product class hierarchy. The Prototype
pattern lets you clone a prototype instead of asking a factory method to
make a new object. Hence you don't need a Creator class hierarchy at all.
This benefit applies primarily to languages like C++ that don't treat
classes as first-class objects. Languages that do, like Smalltalk and
Objective C, derive less benefit, since you can always use a class object
as a creator. Class objects already act like prototypes in these
languages." - GoF, page 120.
When I first read that, I thought to myself "what are they on about?". But
then I realized what they were saying. Does anybody else see the subtle
point they're making?
Creator classes that parallels the product class hierarchy. The Prototype
pattern lets you clone a prototype instead of asking a factory method to
make a new object. Hence you don't need a Creator class hierarchy at all.
This benefit applies primarily to languages like C++ that don't treat
classes as first-class objects. Languages that do, like Smalltalk and
Objective C, derive less benefit, since you can always use a class object
as a creator. Class objects already act like prototypes in these
languages." - GoF, page 120.
When I first read that, I thought to myself "what are they on about?". But
then I realized what they were saying. Does anybody else see the subtle
point they're making?