Skip navigation.
 
mlRe: Guidance for Cocoa's steep learning curve
FROM : Jens Alfke
DATE : Thu May 15 21:06:40 2008

On 15 May '08, at 8:21 AM, colo wrote:

> I get messages and oop [Sender Dosomething] or in Ruby
> @sender.dosomething. OOP was easy for me as thats how I already
> thought code would be like. Of course I am still learning but I fail
> to see why Cocoa syntax could be any different than Ruby.


Um, because it's a different language? (Which is, FYI, called 
"Objective-C", not "Cocoa".)

Objective-C message syntax is closely based on Smalltalk-80, the 
granddaddy* of object-oriented languages. (Ruby is also strongly 
Smalltalk-influenced, but in different ways, and ironically its 
message syntax is more based on C.)

The idea is that selectors, by intermingling the method name with the 
arguments, make the meaning clearer and let you create variant 
versions of methods in a simple way.
In Ruby:
   obj.useString("bar",true,7)        # WTF do all those params mean?
Objective-C:
   [obj useString: @"bar" caseSensitive: YES maxLength: 7];  // much 
clearer!
Note that you can then add versions of this without the maxLength: and/
or caseSensitive: parameters, or with something else entirely:
   [obj useString: @"bar" customTransformer: myTransformer];
which in Ruby would have to be a method called 
"useStringWithTransformer" or something like that.

> I'll test Macruby when 1.9 comes out, but reading Cocoa is like bash 
> my head into needless [] : @ syntax every which way.


It usually takes people about one day to get used to the syntax. 
Complaining about it just because it isn't what you're used to isn't 
very productive.

—Jens

* (as opposed to great-granddaddy Smalltalk-72, and family line 
founder Simula)

Related mailsAuthorDate
mlGuidance for Cocoa's steep learning curve Erik Buck May 15, 03:19
mlRe: Guidance for Cocoa's steep learning curve Ricky Sharp May 15, 04:26
mlRe: Guidance for Cocoa's steep learning curve Scott Ribe May 15, 05:33
mlRe: Guidance for Cocoa's steep learning curve David Wilson May 15, 07:16
mlRe: Guidance for Cocoa's steep learning curve Jens Alfke May 15, 16:59
mlRe: Guidance for Cocoa's steep learning curve Scott Ribe May 15, 17:18
mlRe: Guidance for Cocoa's steep learning curve colo May 15, 17:21
mlRe: Guidance for Cocoa's steep learning curve Uli Kusterer May 15, 17:54
mlRe: Guidance for Cocoa's steep learning curve colo May 15, 18:03
mlRe: Guidance for Cocoa's steep learning curve Jens Alfke May 15, 21:06
mlRe: Guidance for Cocoa's steep learning curve Stefan Werner May 15, 21:17
mlRe: Guidance for Cocoa's steep learning curve Scott Ribe May 15, 21:53
mlRe: Guidance for Cocoa's steep learning curve Bruno Sanz Marino May 16, 00:39
mlRe: Guidance for Cocoa's steep learning curve mmalc crawford May 16, 02:03
mlRe: Guidance for Cocoa's steep learning curve Jens Alfke May 16, 03:06
mlRe: Guidance for Cocoa's steep learning curve Joseph Ayers May 16, 03:33
mlRe: Guidance for Cocoa's steep learning curve Jens Alfke May 16, 04:07
mlRe: Guidance for Cocoa's steep learning curve mmalc crawford May 16, 06:12
mlRe: Guidance for Cocoa's steep learning curve James Merkel May 16, 07:04
mlRe: Guidance for Cocoa's steep learning curve John Terranova May 16, 07:32
mlRe: Guidance for Cocoa's steep learning curve Ilan Volow May 16, 08:55
mlRE: Guidance for Cocoa's steep learning curve john darnell May 16, 15:30
mlRe: Guidance for Cocoa's steep learning curve Michael Ash May 16, 15:49
mlRe: Guidance for Cocoa's steep learning curve I. Savant May 16, 15:57
mlRE: Guidance for Cocoa's steep learning curve john darnell May 16, 16:19
mlRe: Guidance for Cocoa's steep learning curve I. Savant May 16, 16:27
mlRe: Guidance for Cocoa's steep learning curve Jeff LaMarche May 16, 16:29
mlRe: Guidance for Cocoa's steep learning curve Michael Ash May 16, 16:31
mlRe: Guidance for Cocoa's steep learning curve Jens Alfke May 16, 16:50
mlRE: Guidance for Cocoa's steep learning curve john darnell May 16, 16:57
mlRe: Guidance for Cocoa's steep learning curve I. Savant May 16, 17:04
mlRe: Guidance for Cocoa's steep learning curve Michael Vannorsdel May 16, 17:41
mlRe: Guidance for Cocoa's steep learning curve Andy Lee May 16, 20:05
mlRe: Guidance for Cocoa's steep learning curve Scott Ribe May 16, 20:22
mlRe: Guidance for Cocoa's steep learning curve Shawn Erickson May 16, 21:51
mlRe: Guidance for Cocoa's steep learning curve Michael Ash May 17, 08:56
mlRe: Guidance for Cocoa's steep learning curve Torsten Curdt May 17, 11:53
mlRe: Guidance for Cocoa's steep learning curve Michael Ash May 17, 12:02
mlRe: Guidance for Cocoa's steep learning curve Torsten Curdt May 17, 12:46
mlRE: Guidance for Cocoa's steep learning curve john darnell May 19, 15:26
mlRe: Guidance for Cocoa's steep learning curve David Casseres May 22, 05:59
mlRe: Guidance for Cocoa's steep learning curve David Casseres May 22, 06:12