Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!sri-unix!rutgers!psuvax1!vu-vlsi!drexel!rickers From: rickers@drexel.UUCP (Rick Wargo) Newsgroups: comp.lang.misc,comp.lang.smalltalk,comp.lang.c++ Subject: Re: C++ vs Objective-C Message-ID: <509@drexel.UUCP> Date: Tue, 22-Sep-87 01:25:43 EDT Article-I.D.: drexel.509 Posted: Tue Sep 22 01:25:43 1987 Date-Received: Fri, 25-Sep-87 06:09:29 EDT References: <3405@ece-csc.UUCP> <638@its63b.ed.ac.uk> <1811@watcgl.waterloo.edu> Organization: Drexel University, Phila., Pa. Lines: 81 Summary: Each language has its benefits... Xref: mnetor comp.lang.misc:680 comp.lang.smalltalk:330 comp.lang.c++:448 In article <1811@watcgl.waterloo.edu>, kdmoen@watcgl.waterloo.edu (Doug Moen) writes: > csrdi@its63b.ed.ac.uk (Rick Innis, CS4) writes: > >... I'd also like C++, and may well end up porting > >that myself, but I've been told that Objective-C is a better language - > >any versions available? > > Strange... My understanding is that C++ is the better language. As usual - which is the "better" language? All things are created to serve some purpose and both of the aforementioned languages fulfill certain needs. > Objective-C is apparently C with Smalltalk code embedded using escape > sequences. The problem is that when you program in Objective-C, you > have to deal with two universes: the C universe, and the Smalltalk universe. > ... > C++, on the other hand, is a single unified language. It all depends on your needs. You are correct in stating that C++ is a "unified" language, in respect that it is much more "C-like" than as is Objective-C. And yes, the syntax of Objective-C is very similar to that of Smalltalk, but, like C++, the language is a pre-processor, producing C code. If you do not feel like learning all of the ins and outs of object-oriented programming, but would like some more power from a C-like language, C++ is for you. C++ gives much more functionality per time NOT spent learning it than does Objective-C. C++ give the nice-ities of inheritance, without really understanding inheritance too well. In fact, one does not need to know many of the concepts of object-oriented programming to get a lot from C++. Just the strong type checking and inline code expansion are valuable additions to the C language. Like C++, Objective-C has its strengths (and weaknesses) in different areas. Objective-C is a wonderful language for learning object-oriented programming. It has those four qualities of OOPLS - 1. information hiding 2. data abstraction 3. dynamic binding 4. inheritance The dynamic binding is what seperates Objective-C from C++. It is just a wonderful and powerful feature. It gives an object the freedom of not having to recognize all types of messages at compile time, instead it can be done at run-time (yes, at a cost of speed - but Objective-C uses a quick routine to send messages to objects, using a internal hash table). And okay, before I get flamed, C++ does have those virtual functions, but they are not as easy to use as Objective-C's messages (my own opinion!). Try building and utilizing a hetergeneous list in both languages. I found the Objective-C code to be more logical and easier to read and smaller in source code size) than a similar routine written in C++. There are so many other similarities and dis-similaities of the two languages, both of the languages should be investigated to find which one suits your needs to the fullest. Summary: If you wish to gain some of the nice-ities of object-oriented programming without going overboard, then time invested using C++ is well spent. But if you are interested in real object-oriented programming then check out Objective-C. > I'd be interesting in seeing the opinions of people who have had > non-trivial amounts of experience with both languages. I have had lots of experience in the past with both languages, but due to current projects, have not kept up-to-fate with either. It's been two years this month that I had tried (unsuccessfully, I might add) to port Objective-C to the Macintosh for PPI. Supposedly they have someone who is to continue the port. I also taught a "for-fun" class about object-oriented programming, using both C++ and Objective-C as the main languages on which the course was based, though I took concepts of object-oriented programming from many different object- oriented languages and languages with o-o extensions. I also have some (do nothing :-) code which tries to do the same thing in both languages, utilizing a variety of different o-o concepts which I can make available quite easily (i think). > Doug Moen > University of Waterloo Computer Graphics Lab Rickers ..!drexel!rickers