[net.lang.c++] C++ vs. Objective-C

rlw@well.UUCP (Bob Weissman) (03/16/86)

Has anyone evaluated -- or actually USED -- both C++ and Objective-C
from standpoints of ease of programming, clarity of code, and speed
of execution?  Which wins?

-- Bob Weissman
   G.WEISSMAN@SU-SCORE.ARPA
   ...!well!rlw

kanner@tymix.UUCP (Herb Kanner) (03/17/86)

In article <780@well.UUCP> rlw@well.UUCP (Bob Weissman) writes:
>Has anyone evaluated -- or actually USED -- both C++ and Objective-C
>from standpoints of ease of programming, clarity of code, and speed
>of execution?  Which wins?
>
What is "Objective-C"?  Pointer to book, reference manual, or article,
please.  I am presently reading the C++ book and it would be an ideal
time for me to make at least vicarious comparisons.
-- 
Herb Kanner
McDonnell Douglas (TYMNET)
...!hplabs!oliveb!tymix!kanner

keith@cecil.UUCP (keith gorlen) (03/19/86)

>>Has anyone evaluated -- or actually USED -- both C++ and Objective-C
>>from standpoints of ease of programming, clarity of code, and speed
>>of execution?  Which wins?
>>

I have evaluated Objective-C by attending one of their technical
seminars, and I have purchased and studied the Objective-C Reference
Manual, but I have not actually USED Objective-C.  I have used C++
extensively, however.  In my opinion, C++ POTENTIALLY wins by a mile on
all counts.  I say potentially because Objective-C includes a
Smalltalk-80 -like class library in addition to a pre-processor.  C++
provides only the tools for implementing a similar library, which I know
from personal experience to be non-trivial.  In a comparison between
apples and apples, i.e., Objective-C vs. C++ and my Object-Oriented
Program Support (OOPS) class library, the latter wins on ease of
programming and clarity of code, and should also win on speed because of
C++ inline functions and more efficient virtual function calls.

The OOPS class library is in the public domain, but I have a considerable
amount of work left to do on the documentation before it will be in
useable form.

>What is "Objective-C"?  Pointer to book, reference manual, or article,
>please.  I am presently reading the C++ book and it would be an ideal
>time for me to make at least vicarious comparisons.

I don't have their materials handy, but the information you would like
can be obtained from Productivity Products, Inc., Sandy Hook CT.  I
would also recommend their seminars.
-- 
---
	Keith Gorlen
	Computer Systems Laboratory
	Division of Computer Research and Technology
	National Institutes of Health
	Bethesda, MD 20892
	phone:	(301) 496-5363
	uucp:	{decvax!}seismo!elsie!cecil!keith

asw@rlvd.UUCP (Antony Williams) (03/25/86)

In article <60@cecil.UUCP> keith@cecil.UUCP writes:
>   In a comparison between
>apples and apples, i.e., Objective-C vs. C++ and my Object-Oriented
>Program Support (OOPS) class library, the latter wins on ease of
>programming and clarity of code, and should also win on speed because of
>C++ inline functions and more efficient virtual function calls.
>
>The OOPS class library is in the public domain, but I have a considerable
>amount of work left to do on the documentation before it will be in
>useable form.
>
How about posting your library to mod.sources, with a pointer
in this newsgroup, when you are happy with it?  I for one would
appreciate it.  Any other votes?
-- 
---------------------------------------------------------------------------
Tony Williams					|Informatics Division
UK JANET:	asw@uk.ac.rl.vd			|Rutherford Appleton Lab
Usenet:		{... | mcvax}!ukc!rlvd!asw	|Chilton, Didcot
ARPAnet:	asw%rl.vd@ucl-cs.arpa		|Oxon OX11 0QX, UK

stirling@fortune.UUCP (Patrick Stirling) (03/31/86)

>Herb Kanner:
>What is "Objective-C"?  Pointer to book, reference manual, or article,

I thought this would be of general interest to this newsgroup:

Objective-C is a superset of regular C (Kernighan & Ritchie), developed
by Productivity Products International (PPI), 27 Glen Road, Sandy Hook,
CT 06482. Tel (203) 426-1875. They have a C preprocessor that converts 
a program written in Obj-C into ordinary C which you then compile. Here
at Fortune Systems we are writing a Spreadsheet application in Obj-C.
My overall top-of-my-head comments are that Obj-C speeds the initial
development process, mainly by virtue of its modularity and inheritance
features. Classes that are sub-classes of other classes automatically
inherit all of the instance variables and methods (=private functions)
of their superclasses. This helps in tracking down bugs, as it is fairly
easy to trace the exact code that is being executed for any function. Does
C++ do this? The disadvantages that I have found so far are the compile
time (very slow) and the run time (somewhat slower that plain C, because
of the messaging overhead, I think 1 message = approx. 2 function calls).
This is really only a problem where time is of the essence, e.g. screen I/O,
long object searches/comparisons). Feel free to contact me - I don't know
my e-mail path from the net; my phone number is (415) 598-4441. Fortune
Systems Corp, 300 harbor Blvd, Belmont, CA.

patrick

kempf@hplabsc.UUCP (Jim Kempf) (04/04/86)

I haven't had a chance to use C++ yet, so I can't comment on
how good/bad it may be in relation to Objective-C. I have used
Objective-C a little, mostly modifying the internals of the
generated C code to support a persistent object system. Debugging
is a bit of a problem if you don't know (or care to know) the
internals. You need to include something in the source in order
to have the debugger understand the object format. In addition,
the class and phylum files generated by the preprocessor are
a bit of a bookkeeping headache. C++ has a real advantage here.

On the other hand, I wonder if we may not be getting into an
"IBM PC vs. Victor" situation here. Bell can afford to give
away C++ to the universities (as they did with UN*X) while
PPI, being a small company, can't. The result may be (no value
judgements intended) that a technically inferior solution gets
accepted as a standard just because of marketing clout. But
maybe that's the way it goes...
		Jim Kempf		kempf@hplabs

mwherman@watcgl.UUCP (Michael W. Herman) (04/06/86)

Some of PPI's early literature indicated Obj-C was 2.5 times slower
that the equivalent standard C code during execution.  Is the current
version of Obj-C faster?

kempf@hplabsc.UUCP (Jim Kempf) (04/08/86)

> Some of PPI's early literature indicated Obj-C was 2.5 times slower
> that the equivalent standard C code during execution.  Is the current
> version of Obj-C faster?

Messaging is about 2.5 times slower than a function call, since it
is done indirectly, by looking up the function pointer in a cache
(if there is a cache hit) or in the inheritance hierarchy (in
which case it is probably even slower) if there is a miss. There
is probably little they can do to improve this, as they are already
reusing the stack frame from the messaging function. It does give
Smalltalk-like messaging, however. They also encourage replacement
of messaging with a function call during profiling, and have
a couple of profiling tools to measure messaging and memory allocation.
		Jim Kempf		hplabs!kempf