[quote=“PicklePumpers”]You say you don’t see any reason for dot accessors as there is already a way to set and read values but I have to say they are really awesome.
For instance this clunky line:
[self setFido:[self fido] + 1];
Turns into this elegant line:
See how clean and easy to read that is?
Anyway loving the book so far.[/quote]
I also converted the author’s preferred code to the equivalent dot notation: self.fido++, and it is terse and clearer. Usually terse and clearer are working in opposition to each other in your code. In this case, self.fido++ is so clear and easy to type it seems like any cocoa programmer would immediately switch to the dot notation.
The only thing I would point out is that the author’s preferred code explicitly calls the getter and the setter method, which makes it easier for me to see that each accessor is called, where self.fido++ does not make that explicit.
[quote]Another nice thing is Xcode’s auto-completion, i.e. you type
NSOpenPanel *panel = NSOpenPanel openPanel]
and Xcode magically inserts the missing “[” (though it’s not always getting the right position, sadly…)[/quote]
I find the autocompletion of the opposing bracket especially useful when doing an alloc + init:
When I type that last bracket, the code magically becomes:
[[SomeClass alloc] init ];