Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Name instance variables, methods and parameters.



I know that this may be an awfully common question, but I haven't found a
single answer, nor a collection of answers, to give me a better idea. The
section on coding style within Apple's developer documentation states that
an underscore should not be used for naming private methods and instance
variables. I know I have seen this topic being discussed at CocoaDev, but
couldn't gather sufficient information. I'd like to continue to use an
underscore, but if it goes against Apple's own wishes, I'd like avoid it if
I could.

The major problem I have is if I just use an unmodified instance variable,
such as:

NSString *data;

instead of:

NSString *_data;

Which I like better, but conflicts with:

- (id)parseData: (NSData *)data;

I've seen people just use a single character as the name for the parameter
name, but I feel it makes for less readable code.

I suppose it's all a matter of personal preference, but I'd like some input
from more experienced developers.

Thanks!
Eric Czarny
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.