开发者

Objective-C convenient manners

I spent some time with Objective-C and I see it's something like religious for some开发者_开发技巧 (especially experienced) programmers. I like it and I would like to catch good manners. Can you tell me where can I find these holy rules?

For example I'm confused of naming constants, or keys. Should it be kName or nameKey or NameKey?

Or...

I noticed some ivars are declared with _ or __... I want to do clear code. Thanks!


Check these articles about Cocoa and Objective-C style and conventions:

http://cocoadevcentral.com/articles/000082.php

http://cocoadevcentral.com/articles/000083.php

http://cocoawithlove.com/2009/06/method-names-in-objective-c.html


The Coding Guidelines for Cocoa in Apple's Mac OS X Reference Library are a good place to start.


Consistency is the best rule you can ever apply.

Either pick a style you like and stick with it, or if you're working on an existing code base it's good practice to adopt the rules that have already been applied.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜