damon@lmef.UUCP (Damon Scaggs) (12/05/85)
I am curious if anyone has taken an in-depth look into the advantages/ disadvantages of C++ vs Objective C. Someone (I don't remember who offhand) posted a nice discussion of the problems with Objective C. I am curious about what they each implement that the other doesn't. Please don't just tell me to read the new C++ book. My bookstore hasn't heard of it yet. (Any word, when it will actually be available?) BTW: Is anyone planning a C++ BOF at the Denver Usenix? -- Damon Scaggs {ihnp4,akgua}!sol1!lmef!damon
keith@cecil.UUCP (keith gorlen) (12/11/85)
I have looked into both Objective C and C++ extensively. I have not actually programmed in Objective C, but I attended one of their seminars (which I would recommend) and have studied the Objective C reference manual (dated April, 1985). Both Objective C and C++ are C preprocessors that add object-oriented programming features (e.g. encapsulation and inheritance) on top of C. C++ does a prettier job of this, and also adds features such as improved type checking, operator and function overloading, free store management, and inline functions. A major difference between the two is in the implementation of dynamic typing. Objective C uses the Smalltalk terminology of "sending a message" to a "method", C++ refers to this as "calling a virtual member function". Both mechanisms permit the binding between a function call and the implementation of a function to be determined by the type of an object at run time. Objective C implements this binding by searching tables, caching the search results to improve efficiency. C++ builds complete virtual function tables at compile time and just does an indirect subroutine call, but the tables are comparatively large. Thus, C++ trades off space for speed, and also looses a few other capabilities of minor importance (in my opinion). This difference, together with inline functions, means that C++ should be significantly more efficient than Objective C, but I know of no actual comparison that has been done. Objective C also comes with a SmallTalk-80 -like class library that includes collection classes such as Set, Bag, Dictionary, OrderedCollection, etc. and a filer that can store/read data structures comprised of objects of these or any user-defined class to/from disk. C++ does not come with such a class library, but I am implementing one which I hope to place in the public domain if/when the documentation gets written. As of last Summer, Objective C was priced at $5K for binary (cheaper versions are (will be?) available for the Mac and PC) and I believe there is also a version for VAX/VMS. C++ is priced at $2K for a source license, and runs on a variety of UNIX systems. -- --- 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