[comp.lang.c++] C++ and other OOP Langs

samperi@marob.MASA.COM (Dominick Samperi) (04/17/89)

In article <2602@ssc-vax.UUCP> dmg@ssc-vax.UUCP (David Geary) writes:
>like to see comparisons of C++ vs. other object oriented languages such as:
>C++ vs. Modula2
>C++ vs. Lisp
>C++ vs. SmallTalk
>C++ vs. Prolog
>C++ vs. Objective C

I've only read about Objective C, and written a few small C++ programs. It
seems to me that there is a significant performance penalty to be paid for
using Objective C (or SmallTalk), due to massager overhead, for example.
C++ is most often criticized for not being sufficiently object oriented.
But I wonder if this is analogous to criticizing C for not having any
I/O facilities defined as part of the language? That is, is it possible
that with a standardized class library (like K. Gorlen's, for example) that
C++ can be made as flexible (i.e., "object oriented", particularly at
runtime) as Objective C?
-- 
Dominick Samperi -- ESCC
samperi@marob.masa.com
uunet!hombre!samperi

ok@quintus.UUCP (Richard A. O'Keefe) (04/17/89)

In article <2602@ssc-vax.UUCP> dmg@ssc-vax.UUCP (David Geary) writes:
>like to see comparisons of C++ vs. other object oriented languages such as:
>C++ vs. Modula2
>C++ vs. Lisp
>C++ vs. SmallTalk
>C++ vs. Prolog
>C++ vs. Objective C

It is stretching things to call Modula 2 an object-oriented language.
(It is difficult to tell Modula 2 and Pascal apart with the naked eye.)
It is downright false to call Prolog an object-oriented language.
(Even in logic program languges with stream parallelism, object identity
is not supported.)

The main difference between C++ and SmallTalk, as far as I can see, is
that comp.lang.smalltalk isn't full of postings "have I misunderstood
or is this a compiler bug".

maxsmith@athena.mit.edu (Samuel M Druker) (04/17/89)

One should probably keep in mind the age of Smalltalk.  Take an implementation
of Smalltalk from its infancy and see how many bugs you can find.

henry@utzoo.uucp (Henry Spencer) (04/18/89)

In article <1007@quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes:
>>like to see comparisons of C++ vs. other object oriented languages such as...
>
>It is stretching things to call Modula 2 an object-oriented language...
>It is downright false to call Prolog an object-oriented language...

As Bjarne pointed out in one of his papers, "object oriented" is like "RISC"
or "structured":  in marketingspeak, it means "good", so it gets applied to
all sorts of inappropriate or downright silly things.  (Ada was the example
he used.)
-- 
Welcome to Mars!  Your         |     Henry Spencer at U of Toronto Zoology
passport and visa, comrade?    | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

jima@hplsla.HP.COM (Jim Adcock) (04/19/89)

[My opinions, based on a couple years programming in ObjC and C++]
 
> I've only read about Objective C, and written a few small C++ programs. It
> seems to me that there is a significant performance penalty to be paid for
> using Objective C (or SmallTalk), due to massager overhead, for example.

Yes.

> C++ is most often criticized for not being sufficiently object oriented.
> But I wonder if this is analogous to criticizing C for not having any
> I/O facilities defined as part of the language? 

Yes.

> That is, is it possible
> that with a standardized class library (like K. Gorlen's, for example) that
> C++ can be made as flexible (i.e., "object oriented", particularly at
> runtime) as Objective C?

Yes.  As flexible, and probably more so, only different.  Some standard classes
could certainly be useful for the 95% of the programming usage where your
needs don't call for the ultimate in speed or space efficiency.  If you're 
going to want to optimize for that last ounce of performance in the 
critical paths, you may not want to use a standard class.  Once we have
exception handling and memory management, then we should expect to see
a variety of world class reusable base classes.  Writing truly reusable no
compromise base classes is not trivial.

I believe for many base classes operator overloading is necessary to allow
natural usage of base classes as extensions of the language.  Clearly this
is true for math classes such as Complex, Vector, or Matrices.  You want
to be able to say:

	a = b + c;

Not:
        [a assign: [b add: c]];


This is also true of non-math classes:

	myCollection[i] = myObject;

Not:

        [myCollection atIndex: i assign: myObject];

These are trivial examples of the importance of operator overloading in making
natural feeling base classes.  I'm sure others can come up with more important
examples.

I have to admit that I'm less than totally convinced that the Gorlan classes are
the way to go.  I don't think we should be trying to copy Smalltalk approaches in
C++.  I think new, better ways can be found within the context of C++.