Archive for the ‘cocoa’ Tag

The Objective-C Dot Notation Debate

The debate over Objective-C 2.0’s dot notation continues. The latest to touch on the subject are Danny Greg and Kevin Hoctor on the terrific CocoaFusion podcast. I figured I’d weight in on the topic too.

Personally I agree with Matt Gallagher on the topic in that properties are not just a new way to define and use instance variables. They specifically define the state of an object and separate that from what an object can do, the methods.

Besides, they really clean up the code. The less brackets there are the easier it is to read the code. That is always a good thing.

What strikes me as surprising is that none of the Cocoa programmers that have addressed dot notation have seemed to notice that they’ve been doing dot notation using key paths for a while. Dot notation, as I see it, is a further¬†formalization¬†of the key path syntax.

Oh, and by the way, my background is not in languages that usually use dot notation. I have more of a history with Smalltalk then Java. And while I haven’t been coding in Objective-C for long it has been since before the release of Objective-C 2.0 so dot notation and properties were something I had to wrap my brain around and decide if I liked it or not.