Strictly Programming

Objective C Coding Style

Posted in Objective-C by sqllyw on 03/28/2010

Just came across a blog regarding Objective C coding style, very useful:
Cocoa Style for Objective C: Part I
Cocoa Style for Objective C: Part II


Method name:

Here is what I use for

should start with lower case, capitalize the first character of a word, name every parameter including the first one.
Example:

given this path “/users/home/avchd/00001.mts” and string ‘avchd/’, find the starting position of 0001.mts, that’s just right after the ‘avchd/’

version 1:
+ (NSUInteger) getStartingPos : (NSString *) aPath after : (NSString *) aSubPath;

this works, but the first parameter ‘aPath’ was not named, adding the subfix ‘InPath’ makes it clear:

version 2:
+ (NSUInteger) getStartingPosInPath : (NSString *) aPath after : (NSString *) aSubPath;

Advertisements
Tagged with:

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: