By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,369 Members | 1,131 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,369 IT Pros & Developers. It's quick & easy.

GoF:"C++ [doesn't] treat classes as frist class objects"

P: n/a
"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?
--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/
Sep 6 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Steven T. Hatton wrote:
"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?


Yes.
Sep 6 '05 #2

P: n/a
Steven T. Hatton wrote:
"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?


No.
Please elaborate. ;-)

Sep 6 '05 #3

P: n/a

"Steven T. Hatton" <ch********@germania.sup> wrote in message
news:C9********************@speakeasy.net...
"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?
Is this a quiz? Or are you complaining about their lack of explanation?
Or...?

(BTW, what's "GoF"?)
--
NOUN:1. Money or property bequeathed to another by will. 2. Something
handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/


What's that all about?

Sep 6 '05 #4

P: n/a
Howard wrote:
(BTW, what's "GoF"?)


"Gang of Four". The book "Design Patterns" by Gamma, et al.
Sep 6 '05 #5

P: n/a
"Steven T. Hatton" <ch********@germania.sup> wrote in message
news:C9********************@speakeasy.net...
"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?

[...]

No, everything I gathered was stated clearly. "Design Patterns" isn't much
for subtlely, IMHO.

--
David Hilsee
Sep 7 '05 #6

P: n/a

"red floyd" <no*****@here.dude> wrote in message
news:jY***************@newssvr13.news.prodigy.com. ..
Howard wrote:
(BTW, what's "GoF"?)


"Gang of Four". The book "Design Patterns" by Gamma, et al.


Ah, ok. Thanks.
-Howard

Sep 7 '05 #7

P: n/a
In article <C9********************@speakeasy.net>,
Steven T. Hatton <ch********@germania.sup> wrote:
"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?


This:
--------
convertAll: aCollection with: aClass

| ans |

ans := (aCollection class) new.

aCollection do: [ :i |
ans add: ((aClass new) initialize: i) ].

^ans
--------
would be hard to do without some code gymnastics in a language like C++
that doesn't treat classes as first-class objects.
Doesn't seem all that subtle to me, though.
dave

--
Dave Vandervies dj******@csclub.uwaterloo.ca
Not only has Richard done something *useful* for the C community,
his worth is measured in pence and pounds, not dimes and dollars.
--Chris Dollin in comp.lang.c
Sep 9 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.