Linked by Jared White on Thu 24th Apr 2003 17:49 UTC
General Development There are two major varieties of Cocoa available. The first variety, possibly the more well known of the two, is the kind that you can use to make a nice warm cup of chocolate milk. While tasty, it's hardly proper subject matter for an operating systems information site. The second variety is far more on-topic: a programming environment for Apple Mac OS X that is the modern evolution of of the original NeXTSTEP frameworks. That's what I'm here to talk about today.
Permalink for comment
To read all comments associated with this story, please click here.
Named arguments
by Eric Wang on Fri 25th Apr 2003 01:33 UTC

"As far as naming parameters being easier, not only do you have to remember their order, you also have to remember their name, unless you have a reference for the class you're using, and then the point is moot."

Cocoa methods are named very consistently -- you can often just guess at the method name you want to use w/o consulting the documentation.

The main benefit with named arguments is not in recalling method names, but in reading source code. If you are not familiar with a piece of code (or you are revisiting your own code after a long hiatus), a line like

[shape drawAtXCoord:2 yCoord:7 width:5 height:10 bordered:YES];

is a lot easier to decipher than the more Java-like


I wish more languages provided named arguments. The only ones I know of are Smalltalk and Objective-C. Any others out there?