473,396 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

"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
7 1667
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
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

"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
Howard wrote:
(BTW, what's "GoF"?)


"Gang of Four". The book "Design Patterns" by Gamma, et al.
Sep 6 '05 #5
"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

"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: george young | last post by:
I had developed the habit of using the neat python form: if someinstance: someinstance.memb() because it seems cleaner than "if someinstance is not None". {please no flames about "is not None"...
0
by: Anthony Baxter | last post by:
To go along with the 2.4a3 release, here's an updated version of the decorator PEP. It describes the state of decorators as they are in 2.4a3. PEP: 318 Title: Decorators for Functions and...
12
by: cppaddict | last post by:
Hi, I know that it is illegal in C++ to have a static pure virtual method, but it seems something like this would be useful when the following 2 conditions hold: 1. You know that every one...
3
by: Generic Usenet Account | last post by:
This is a two-part question. (1) I have implemented a "Datastructure Registry" template class. I am getting no compiler warnings with older compilers, but newer compilers are generating the...
3
by: babylon | last post by:
any facilities in csharp that can help me implmenting undo/redo in my application? thx
9
by: Mike Labosh | last post by:
Code is easy. These are two OOP design issues that I am chewing on. Coming from classic VB, I'm not great at OO design. I prefer to write mile long spaghetti methods in a Temp module, and then...
24
by: M O J O | last post by:
Hi, Instead of doing this.... Public Class Form1 Public Shared Sub CreateAndShow() Dim f As New Form1 f.Show() End Sub
11
by: arnuld | last post by:
this is the code which runs without any trouble: ----------------------------------------------------- #include <iostream> #include <string> #include <vector> struct Entry { std::string...
4
by: Gianni Mariani | last post by:
Two issues here: a) What is the accepted definition of "observer pattern". While I can't point to anything specific, I do remember having issues with inconsistency in the definition. b)...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.