From: cshaver@informix.com (Craig Shaver)
Newsgroups: comp.lang.c++
Subject: Re: Need help implementic data structures of generic objects
Date: 13 Dec 92 00:25:51 GMT
Organization: Informix Software, Inc.

In article <MATT.92Dec11162629@physics.berkeley.edu> matt@physics.berkeley.edu writes:
>In article <1992Dec11.233253.27540@informix.com> cshaver@informix.com (Craig Shaver) writes:
>
>> >>class Object {
>> >>    /* ...etc... */
>> >>};
>> >
>> >	Dont do this Smalltalk hack please. A queue of Objects is
>> >totally useless, since they are just Objects and not ever Widgets.
>> 
>> YES! Do that elegant Smalltalk thing.  Do not listen to C++ hacks and
>> bigots.  Put a little thought into it and do something (re)useful.
>
>The problem is that in C++, as opposed to Smalltalk, this *isn't*
>terribly elegant.  The question is: what can you do with an Object?
>If you put a Widget into a list of Objects, you can't call any of the
>Widget member functions; you can only call the Object member
>functions.
>
>You can, of course, access the Widget member functions by downcasting
>the Object* to a Widget*, but I would scarcely call that elegant.
>(Also, of course, you're deliberately violating the language's type
>checking, so you're opening yourself up to all sorts of fun bugs.)  I
>would suggest that if your program makes heavy use of downcasting,
>then you are probably not using the best possible design.
>
>There probably are some programs for which Smalltalk is a better
>choice of language than C++.  For those programs, the simple solution
>is just to use Smalltalk; as Dr. Stroustrup has pointed out, Smalltalk
>does a far better job of being Smalltalk than C++ ever will.
>--
>Matthew Austern                   Just keep yelling until you attract a
>(510) 644-2618                    crowd, then a constituency, a movement, a
>austern@lbl.bitnet                faction, an army!  If you don't have any
>matt@physics.berkeley.edu         solutions, become a part of the problem!

*** WARNING ***
flame on!
Another tech weenie C++ bigot speaks out against Object Oriented Programming
methodology in general!  (no :')
flame off!

This group seems to be biased against inheritance techniques in all cases.

Matthew is going through the physics department of berserkeley, so I have
to assume we are dealing with a person of intelligence.  That is unless
the night janitor has an interest in C++ class libraries.

It is obvious to me that you have a virtual function in the base class for 
all functions that you need to use when dealing with 'Objects'.

If you use a function on a class that is only restricted to a certain
sub-tree of your inheritance structure, then you know what you are using,
ergo, you should have used that type instead of 'Object'.

IMHO, if you do not use inheritance, you are not doing OOP.  If you do
not care, then you are just using C++ as a variation on C with no real
benefit.

The tech weenies that like technology for technology's sake are just
so much useless overhead.  I have seen too many hackers take a good idea
to extremes and I feel that this is happening wherever C++ is being
used in a commercial environment.

The reason commercials are using C++ is because they have heard that OOP
will save them money and allow them to build more software faster and with
fewer bodys.  If this does not turn out to be the case then C++ will not
be used.  The point being that if everyone does not use C++ to build economical
and reusable solutions then eventually a backlash will occur and it will
start to get the bad press it deserves.  I think this is starting to
happen, and I expect to hear something soon out of Borland about this
subject.

So if you insist on making something more complicated than is needed and
you do not use good sense and good software engineering practices; it may come
back to haunt you.  But like most sniveling nerdy tech weenies you will
be on your way with C++ stamped on your resume.  The last company will
be trying to sweep the embarrassment you left behind under the rug.

This posting does not begin to express my full feelings on this matter.
I suspect that it will fall on deaf ears, and it may ramble a bit.
But it make me feel good to write.

Please; in all of the above, correct me if I have been technically
wrong, and then explain your philisophical counter point to the
use of inheritance.

If I offended anyone that is just tough.

-- 
Craig Shaver  (cshaver@informix.com for now) (415)390-0654 (415)926-6407
Productivity Group POB 60458 Sunnyvale, CA  94088
Newsgroups: comp.lang.c++