[comp.lang.objective-c] Examples please

wag1@cbnewsl.att.com (d.wagley) (05/24/91)

I've heard alot of complaints in this newsgroup about how C++ is
inferior to objective-c. One nice thing about C++ is that it's
easy to find lots of information on it. The only thing I've found
so far on objective-c is Brad Cox's book, which seems to be more
a discussion of the object oriented approach than a tutorial on
objective-c. 

Perhaps one of the experienced objective-c programmers who has seen
the light could post some simple commented examples of objective-c? 

					Thanks,
					   Doug

scott@mcs-server.gac.edu (Scott Hess) (05/25/91)

In article <1991May24.143213.25931@cbnewsl.att.com> wag1@cbnewsl.att.com (d.wagley) writes:
   I've heard alot of complaints in this newsgroup about how C++ is
   inferior to objective-c. One nice thing about C++ is that it's
   easy to find lots of information on it. The only thing I've found
   so far on objective-c is Brad Cox's book, which seems to be more
   a discussion of the object oriented approach than a tutorial on
   objective-c. 

Not that I'm going to offer up any example code - I've got what I've
written on the NeXT-specific archives, and since it's all NeXT-
specific code, it's not good Objective-C example code.

But, I think you've taken any of the c++ denigration that periodically
occurs on this group wrong.  C++ isn't really inferior to Objective-C,
anymore than a tire iron is inferior to an Allen wrench.  It's just
that they don't do the same jobs.  When you need an Allen wrench, a
tire iron does you no good, and vice versa.

Obviously, c++ and Objective-C are slightly closer than tire irons
and Allen wrenches, but those things they do _well_ are far enough
apart to make the overlap a relatively minor consideration when you
are deciding on a new language.  For instance, you cannot do the
'perform:', 'perform:with:' and other similar methods in c++
at this time - while c++ is excellent at encapsulating small
chunks of information (Objective-C is not, as it's less efficient
if you get too fine-grained, at least when compared with c++).

The question people really need to consider before deciding
between the two languages is whether either of them even fit
their needs.  Then, they should decide if maybe _both_ could
be used (not really a solid option until GNU's Objective-C
comes out), and only then should they decide which one makes
the most sense in their situation.  If the first two questions
are asked in a serious manner, and answered objectively (pardon
the pun), the third question would seldom (if ever) need to be
asked.

Later,
--
scott hess                      scott@gac.edu
Independent NeXT Developer	GAC Undergrad	<Finals done!>
<I still speak for nobody>
Note:  I will be moving home soon.  My email address will still be
valid.  Any SnailMail should be redirected, along with phone calls.
At the least, my parents can tell you how to get hold of me, or
forward any mail . . .
Old:	PO 829, GAC, St. Peter, MN  56082	(507) 933-8466
New:	RR#4 Box 227 Pipestone, MN  56164	(507) 825-2788

comeau@ditka.Chicago.COM (Greg Comeau) (05/28/91)

In article <1991May24.143213.25931@cbnewsl.att.com> wag1@cbnewsl.att.com (d.wagley) writes:
>
>I've heard alot of complaints in this newsgroup about how C++ is
>inferior to objective-c. One nice thing about C++ is that it's
>easy to find lots of information on it. The only thing I've found
>so far on objective-c is Brad Cox's book, which seems to be more
>a discussion of the object oriented approach than a tutorial on
>objective-c. 

I DO NOT want to be responsible for a O-C vs C++ rwar here.  I would
like to mention though that as this *is* an O-C newgroup, there *are*
going to be biased opinions expressed here.  To be fair though, there
will also be unbiased ones.

As to which language is inferior.... there is no question that certain
individuals will fight to their death over this.  My own personal preference
is for C++, and I have used it quite successfully, but many O-C enthusiasts
will be able to make the same claim.  The bottom line is not quite the question
of which is inferior or superior, but which does the better job for *you*.
And in addition, which does the better job for your projects.  FOr instance,
if it's more of a Smalltalk'y feel  you want, the O-C is probabky the best
route to take.  If it's early compiler diagnosticis, strong typing, more info
and availability, then go with C++.  O-C is typically better at prototyping
though.  But the C++ is a true C graft.  And so on.  Neither really ever
truly wins.

If you look at my .signature, the above may sound odd coming from me.
But that is the way it is.  I mean it's really  no different than asking
whether C is better than Pascal.  My preference is pro C and to snarl at
Pascal.  Realistically though, it just means I favor C as besides issues
like C's pointer capability the 2 languages can be used similarly.  But issues
just like C's pointer capbilities are where individuals draw their lines.
For instance, I may see the power and usability of C pointers, while a
Pascal'ite see terse and unreadable code with no type checking.

Which is worst?  Neither.  Which is better?  That depends.

- Greg
-- 
	 Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418
                          Producers of Comeau C++ 2.1
          Here:attmail.com!csanta!comeau / BIX:comeau / CIS:72331,3421
                     Voice:718-945-0009 / Fax:718-441-2310