Re: Accessor method idioms...
Re: Accessor method idioms...
- Subject: Re: Accessor method idioms...
- From: John Brownlow <email@hidden>
- Date: Thu, 24 Mar 2005 11:53:10 -0500
I've tried writing like this but it always starts to feel redundant, an
unnecessary layer of indirection. Maybe there are circumstances where
it's helpful but... I haven't found them.
[[self things] objectAtIndex: index]
Just seems way more transparent than:
objectInThingsAtIndex: index
at least when 'things' is a built-in type like NSArray, anyway
I guess if you are actually implementing some kind of new-fangled way
of obtaining the object at a particular index it makes sense... for
example, I have an array of pages in a script, which starts at 0, while
the page numbering the user sees starts at 1. So I have an accessor
something like
- (GLPage *)pageAtPageNumber: (int) pageNumber
{
return [[self pages] objectAtIndex: pageNumber-1];
}
In this case it makes sense to me to use a custom accessor but it seems
to obscure things in the vanilla case.
On Mar 24, 2005, at 11:15 AM, Mike Ferris wrote:
- (id)objectInThingsAtIndex:(unsigned)theIndex {
--
John Brownlow
Deep Fried Films, Inc
http://www.johnbrownlow.com
http://www.pinkheadedbug.com
_______________________________________________
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