• 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: How far with accessors?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >How far with accessors? (From: Don Rainwater <email@hidden>)

  • Prev by Date: Re: Looking for Cocoa diff and hash objects/ library
  • Next by Date: Re: Problem with NSOutlineView outlineView:willDisplayCell:forTableColumn:item: delegate method
  • Previous by thread: How far with accessors?
  • Next by thread: Re: How far with accessors?
  • Index(es):
    • Date
    • Thread