Re: loop efficiency & messages
Re: loop efficiency & messages
- Subject: Re: loop efficiency & messages
- From: Will Mason <email@hidden>
- Date: Wed, 23 Mar 2005 11:17:01 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
> >> 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.
I've really enjoyed everyone's replies on this topic, and I definitely
see the points your making in yours. However, the original poster, as
you can see above, said "objective C" [sic], and everyone, including
you, chose to replace that with "Cocoa". Cocoa and Objective-C are
distinct. I also find it difficult to believe that you, presumably an
experienced Cocoa programmer, could ever be confused by this method
signature: - (int) getCount. So, you see a method that takes no
arguments, returns an int and starts with the word "get", and you get
confused? Sorry, but I don't buy it.
In spite of those objections, I agree that it's a good idea to stick to
conventions, as long as there is something to be gained by doing so. I
just fail to see exactly what that something might be in the case of: -
(int) getCount.
Take care,
Will
_______________________________________________
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