Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ObjC Method naming



Well, I'm probably gunna be smacked for saying this, but how about this
for anyone still stuck on C++ thinking?

#define SetRect(theRect,x,y) [theRect setWidth:x height:y]

::ducks::

Alright, just kidding, I dont actually think you should bastardize Obj-C
like that. At first I was really opposed to typing more, but suddenly I
realized the Obj-C way was a Good Thing

1) No more calls like DoSomething(&wind,NULL, kDocumentWindowType, true,
NULL, NULL, -1L); I'm sure you've all had to write code like that
before!

2) I ported an app to cocoa with little to no knowledge of objective-c
while at WWDC in a few hours - the app written in the Macintosh Toolbox
took months to make... I suddenly dont mind writing [theRect setWidth:x
height:y] instead of SetRect(&theRect, theRect.left, theRect.top,
theRect.left+x, theRect.top+y); Wait - suddenly Obj-C is looking pretty
nice, thats even LESS typing. :-)

But seriously, typing 20-50% more than in C++ is definitely acceptable
since you no longer have to write (and debug!) thousands of lines of
code just to power your big complicated Mac-like GUI.

Just my 2 cents - its all I have left after paying to attend WWDC ;-)

Mike Margolis
yes, I was that kid who was in the cocoa feedback session and told
the story of porting to cocoa in a few hours if you were wondering.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.