tomm@asgb.UUCP (Tom Mackey) (01/15/86)
I have been hearing rumors regarding a C++ vs Objective-C discussion on the net. I have been watching net.lang and net.lang.st80, but finally found some reference to the two languages on net.lang.c. I think a net.lang.c++ may someday be in order. To get to the point, we here at Burroughs DSG have used both languages in our current (very large) software development. We started out with Objective-C, but switched to C++ when it became available to us. What follows is an encapsulated comparison study written by my manager, who has asked me to post this. Since Gary is usually too busy to read either E-mail or net news, please reply directly to me, and I will dump a hard copy and put it on his chair (the only sure way to contact him :-) ). I was involved in the study, and therefore could answer any questions you might have. Of the present staff, I have written more Objective-C code than anyone else, and re-wrote almost all of that in C++. Just to give you an idea of the similarities, I re-coded my approx. 2000 lines of debugged Objective-C code into C++ in about 2 weeks time...that is taking time out for some extensive re-designing, so I can't say exactly how many lines of C++ corrosponds to how many lines of Objective-C. If there is enough interest, however, I can do that with a doubly-linked-circular list object class that I wrote in both languages. So without further ado, I give you Gary's study, enclosed in the dashed lines, and followed by my net address. I am posting this to net.lang, net.lang.c, and net.lang.st80; please direct all followups to net.lang.c. Thanks, -Tom M.- ------------------------------------------------------------------------- Subject: Objective-C vs. C++ Comparison Study We did an Objective-C vs. C++ comparison study at Burroughs Distributed Systems Group, Boulder Colorado, covering the following areas: 1. Ease of use/learnability. 2. Development time. 3. Execution speed. 4. Code/data size. 5. Maintainability. Both Objective-C and C++ offer data abstraction features with classes, objects, and inheritance; Objective-C following the Smalltalk syntax and C++ more closely modeled to Simula. Both language implementations are really "translators" that sit between the "C" pre-processor and the "C" compiler for the particular system--both take source code and generate "good old C" code for compilation, so portability to different processors is excellent. In addition, object code generated from C++ is link-compatible with object code from "good old C"; in fact, C++ is a superset extensions of C (to the point where it will compile a C program just fine, thank-you), while Objective-C is not. We wrote programs implementing the same functionality and made measurements that were both objective and subjective in nature on System 5.2 UNIX running on VAX 11/750s and 11/780s. By "objective" we mean that system performance measuring commands such as "time" and "size" were used; by "subjective" we also recorded our feelings as to how comfortable we felt with the language, etc. It was our conclusion that C++ significantly beat Objective-C in every category. For some categories, such as execution speed and code/data size, this is not surprising--C++ is wonderfully efficient. However, one might have expected development and maintainability to have fared better with Objective-C. Compilations using Objective-C took in some cases two to three times longer than C++ compilations for similar programs. Yet, because Objective-C employs an artificial file dependence called "phyla" to speed up the execution performance, we felt in the end that we were left with a less maintainable product using Objective-C than with C++. Our people found the creation and maintenance of phyla dependencies unnatural, awkward, and very time-consuming to recompile. It seemed to us that Objective-C tried to offer maintainability with classes with one hand and usurped it all (and more) by requiring phyla with the other hand. Yes, this is harsh criticism for a package that claims to offer the prospect of more reliable software products, but these were our conclusions. Objective-C, in its favor, does offer a very nice run-time library of handy classes for "containers", filing, and debugging. These library capabilities are not always useful or desireable, however; it depends on your application and intended usage. C++ comes with a smaller "general library" of classes but is easily extended and can be used with "sdb" with less fuss. Gary Walker, Manager, Primary Interaction Development Burroughs Distributed Systems Group 6655 Lookout Road Boulder, Colorado 80301 (303)-530-6754 ------------------------------------------------------------------------- Tom Mackey hao!\ (303) 530-6693 ihnp4!sabre!\ \ hplabs!sdcrdcf!-bmcg!asgb!tomm { ihnp4, ucbvax, allegra }!sdcsvax!/ Burroughs Distributed Systems Group Boulder, Colorado