Re: How far with accessors?
Re: How far with accessors?
- Subject: Re: How far with accessors?
- From: Joseph Heck <email@hidden>
- Date: Wed, 26 May 2004 12:47:16 -0700
I tend to use accessors in my code for darn near everything. It makes
implementing the undo/redo logic WAY easier, and provides some future
hooks for things like bindings. If something is entirely within a data
structure that won't ever see a public access, then I don't worry too
much about it, but I found that was pretty rare with my projects. YMMV.
Completely side topic:
Don't use the _ before any variable name. I found out the hard way that
it's used internally by Apple for private bits, and Objective-C lets
you override those private bits quite easily, which makes for some
really freaky debugging sessions. I got used to that very convention
when learning Java, and it's taken me quite a while to break it.
-joe
On May 26, 2004, at 11:51 AM, Don Rainwater wrote:
How far should I go with using accessors to do things to instance
variables? For example, say I have the following:
@interface theRecord : NSObject {
NSString *_theString;
}
_______________________________________________
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.