On Apr 5, 2008, at 15:44, Dennis C. De Mars wrote:
There's another solution besides naming conventions. I've been through most of them -- underscore prefix or postfix, prefix with "m" etc. I generally don't find naming conventions very satisfactory. It seems like I'm trying to encode something into the name that should be evident from the syntax of the language or the context the variable is used in.
I think the issue with all the solutions suggested so far (myWhatever, theWhatever, aWhatever, mWhatever, lpWhatever, _whatever, self- >whatever) is that they're trying to encode primarily *syntactic* information into the variable name. While there's nothing wrong with that, some of us (including you, it seems from your comments) find it somehow ugly or redundant or ... something.
Another approach is to qualify the property name *semantically* instead. The most common situation where I run into local/instance variable name conflicts is setter methods. If the property and the instance variable are both 'whatever', it makes sense to me to call the setter argument variable 'newWhatever', because that is in fact what it is. That makes it natural, when you need to move the instance variable into a local variable, as often happens when releasing and retaining, to call it 'oldWhatever'.
In other scenarios, other choices suggest themselves. Sometimes it makes sense to call a local copy of the instance variable 'currentWhatever'. For arguments to initializers, where a value is passed in that's going straight into an instance variable, the argument can be called 'initialWhatever'.
Notice that none of those names tell you what the variable is, syntactically, but they do tell you what it's for, semantically. To me, that's useful information.
FWIW. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]