Re: Re:
Re: Re:
- Subject: Re: Re:
- From: Scott Thompson <email@hidden>
- Date: Wed, 22 Aug 2007 15:46:53 -0500
On Aug 22, 2007, at 11:30 AM, Shawn Erickson wrote:
On 8/22/07, Daniel Child <email@hidden> wrote:
Your list of advice brings up host of questions. Specifically, (in
reference to your points)
#1 (always use accessors)
Would you recommend using accessors even for primitive instance
variables (int, BOOL, etc.), where there is no need to retain, copy,
etc.
The fact that you store them internally as a primitive instance
variable currently doesn't mean that in the future you may store them
a different way. If you provide accessors as the interface to get at
the data then you have more freedom to change your implementation in
the future without affecting client code.
I like to call this the "trained squirrel" principle. The value that
you keep internally may be an instance variable. It may be computed
from several variables. It may be fetched over the network, or it
could be generated by trained squirrels that are kept on-hand for the
purpose.
The point is that where the information comes from is an
implementation detail.
What's important to to ensure that the information in question really
needs to be part of the public interface of your class.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >Re: (From: Daniel Child <email@hidden>) |
| >Re: (From: "Shawn Erickson" <email@hidden>) |