Re: loop efficiency & messages
Re: loop efficiency & messages
- Subject: Re: loop efficiency & messages
- From: Charlton Wilbur <email@hidden>
- Date: Wed, 23 Mar 2005 11:00:33 -0500
On Mar 23, 2005, at 7:23 AM, Will Mason wrote:
Not exactly on topic but getCount is a lousy name for a method in
objective C.
Oh, don't be daft. Naming a getter method in Objecitve-C is no
different from naming a getter method in any other language, and Java
for instance routinely uses "get" to prefix a getter method. Just
because "get" is discouraged by Apple doesn't mean we should all run
from it in terror. Frankly, if a method is named getCount or count,
it's equally easy to read and understand no matter what language in
which it's written.
Except that messages starting with "get" in Cocoa have a specific
meaning: that you're going to be passing in a pointer to something
that the method is going to fill in and return. (I can't find a cite
in the online docs for this, alas, or I'd point you to it.)
getCount *is* a lousy name for a method in Cocoa, unless it takes an
argument into which it puts the count. You'll confuse experienced
Cocoa programmers, and (once the experienced Cocoa programmer realizes
that there's no reason for the inconsistency) you'll mark yourself as
someone who doesn't understand the value of sticking to established
coding conventions. Any street cred you get from daring to flout
Apple's conventions will be lost when the person you're trying to
impress realizes you don't understand why the convention is in place.
Charlton
--
Charlton Wilbur
email@hidden
email@hidden
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden