Joachim Bondo
2010-01-26 09:32:33 UTC
Thanks for providing the Coding Style Guide, Gus. In the hope that
this won't start a long discussion (we don't really need that), I have
two comments:
1) At WWDC 2009, Apple recommended *not* to prepend instance variables
with underscore, because that's used by Apple and could cause name
clashes. What I'm doing in my own projects is appending the
underscore, like in myInstanceVariable_.
2) Related to the above, for "private" methods, declared in .m's
@interface MyClass () block, I name the methods with a prefix to avoid
the same kind of possible name clashes, like LA_myPrivateMethod.
My recommendation is to incorporate these two points into The Official
Letters Coding Style Guide.
As a personal note, I've become quite fond of Google's Objective-C
Style Guide [0]. In particular, my code is never more than 100 chars
wide (Google recommends 80, but that's *too* old-school) which means I
can easily size and arrange my editor window and see all code without
having to scroll horizontally (which we all hate). As a consequence
I'm not aligning the colons in method calls which I thought would be a
problem at first, but with syntax-highlighting, this is not a
sacrifice in legibility. I also started using 2-space indentations as
per their guide.
My basic coding style is also greatly inspired by Apple's Coding
Guidelines for Cocoa [1], of course.
[0] http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml
[1] http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/index.html
Joachim
http://cocoastuff.com
@osteslag
this won't start a long discussion (we don't really need that), I have
two comments:
1) At WWDC 2009, Apple recommended *not* to prepend instance variables
with underscore, because that's used by Apple and could cause name
clashes. What I'm doing in my own projects is appending the
underscore, like in myInstanceVariable_.
2) Related to the above, for "private" methods, declared in .m's
@interface MyClass () block, I name the methods with a prefix to avoid
the same kind of possible name clashes, like LA_myPrivateMethod.
My recommendation is to incorporate these two points into The Official
Letters Coding Style Guide.
As a personal note, I've become quite fond of Google's Objective-C
Style Guide [0]. In particular, my code is never more than 100 chars
wide (Google recommends 80, but that's *too* old-school) which means I
can easily size and arrange my editor window and see all code without
having to scroll horizontally (which we all hate). As a consequence
I'm not aligning the colons in method calls which I thought would be a
problem at first, but with syntax-highlighting, this is not a
sacrifice in legibility. I also started using 2-space indentations as
per their guide.
My basic coding style is also greatly inspired by Apple's Coding
Guidelines for Cocoa [1], of course.
[0] http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml
[1] http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/index.html
Joachim
http://cocoastuff.com
@osteslag