[Biococoa-dev] Method names with 'and'

Charles PARNOT charles.parnot at stanford.edu
Fri Mar 11 02:30:24 EST 2005


Sorry I had one minor comment I forgot about your new code, Philip, 
more specifically method names: in some of the methods are something 
like 'initWithSymbols:andMatrix:'. I believe 
'initWithSymbols:Matrix:' is more "Cocoa-standard".

... a few minutes interruption...

OK, because I did not want to look too picky and stupid, or be wrong, 
I looked in:
http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingMethods.html#//apple_ref/doc/uid/20001282/BCIBJEFG

Excerpt:
"Don't use "and" to link keywords that are attributes of the receiver.

RIGHT:
- (int)runModalForDirectory:(NSString *)path file: (NSString *) name 
types:(NSArray *)fileTypes;

WRONG:
- (int)runModalForDirectory:(NSString *)path andFile:(NSString *)name 
andTypes:(NSArray *)fileTypes;

Although "and" may sound good in this example, it causes problems as 
you create methods with more and more keywords."

Apple said it, not me ;-)

charles

-- 
Help science go fast forward:
http://cmgm.stanford.edu/~cparnot/xgrid-stanford/

Charles Parnot
charles.parnot at stanford.edu

Room  B157 in Beckman Center
279, Campus Drive
Stanford University
Stanford, CA 94305 (USA)

Tel +1 650 725 7754
Fax +1 650 725 8021



More information about the Biococoa-dev mailing list