• 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 methods and (auto)release: conclusion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessor methods and (auto)release: conclusion


  • Subject: Re: Accessor methods and (auto)release: conclusion
  • From: Marco Scheurer <email@hidden>
  • Date: Tue, 6 Aug 2002 21:31:07 +0200

On Tuesday, August 6, 2002, at 07:01 pm, Ondra Cada wrote:

Now, since collections are definitely excluded from the accessor pattern you advocate, your "invariant" does not hold either.

More or less it does, for it is questionable whether -addObject should be called a setter and -objectAtIndex should be called a getter ;)

OK, let's hope we do not shift to dialectics and a debate about the definition of an accessor.

Here are more reasons not to use the [[object retain] autorelease] pattern for a getter, and this time, performance related:

1) Collections are excluded from the pattern for performance reason. Most would say that performance is not an issue for [window title]. How do you decide for [person name] ? There is no way, as the framework provider to know how person objects will be used.

2) If you use the [[object retain] autorelease] pattern, you make profiling difficult. The performance penalty is not just the cost of sending the retain and autorelease messages, but also the time spent managing the autorelease pool.

3) If you use the [[object retain] autorelease] pattern, and it turns out to be a performance issue, you make optimization difficult. Once you've used that pattern, you are stuck with it, or else client code (not necessarily yours, of course) could break. So you put the burden of optimization on the client, who might see some improvements by using nested pools, but who might end up writing a category to speed up your accessor.


Marco Scheurer
Sen:te, Lausanne, Switzerland http://www.sente.ch
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Accessor methods and (auto)release: conclusion
      • From: Ondra Cada <email@hidden>
References: 
 >Re: Accessor methods and (auto)release: conclusion (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Accessor methods and (auto)release: conclusion
  • Next by Date: Re: Accessor methods and (auto)release: conclusion
  • Previous by thread: Re: Accessor methods and (auto)release: conclusion
  • Next by thread: Re: Accessor methods and (auto)release: conclusion
  • Index(es):
    • Date
    • Thread