• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accessor method idioms...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessor method idioms...


  • Subject: Re: Accessor method idioms...
  • From: Mike Ferris <email@hidden>
  • Date: Fri, 25 Mar 2005 07:30:53 -0800

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.

Absolutely. That's why only the first three methods -things, -setThings: and -mutableThings are public.


But, you need to implement at least some of the keyed accessors or the performance behavior of mutableArrayValueForKey: will be ridiculous.

What I was trying to get at was a minimal public API that kept a couple things true:

- There are accessors (the generic and untyped KVC methods do not constitue a "good" "direct" API in my opinion)
- They perform reasonably well


Mike

_______________________________________________
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


References: 
 >Accessor method idioms... (From: Mike Ferris <email@hidden>)
 >Re: Accessor method idioms... (From: John Brownlow <email@hidden>)

  • Prev by Date: Custom Cell highlighting
  • Next by Date: Re: A Challenge WAS Accessor method idioms...
  • Previous by thread: Re: A Challenge WAS Accessor method idioms...
  • Next by thread: NSMenu conundrum
  • Index(es):
    • Date
    • Thread