• 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
Is there a convention...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is there a convention...


  • Subject: Is there a convention...
  • From: Jeff LaMarche <email@hidden>
  • Date: Sat, 27 Jul 2002 21:26:46 -0700

This may be a bizarre question. When you have an object that you want to
be treated as a private member, the convention seems to be to start the
iVar's name with an underscore. This is the way that I've approached my
objective-C programs, and I generally do not include any
headerdoc-readable comments for my accessors and set methods.

However, I still create accessor methods and setter (is that the right
term) methods to make it easier to implement NSCoding and NSCopying. I'm
never sure how to name these methods, however. Is there a convention?

There seem to be a number of possible options. Let's assume an iVar:

NSImage *_myPrivateIVar;

I could see all of these being logical choices:

-(void)set_MyPrivateIVar;(NSImage *)inImage;
-(void)set_myPrivateIVar;(NSImage *)inImage;
-(void)setMyPrivateIVar;(NSImage *)inImage;

But I'm not sure which, if any, of these will work with valueForKey:.
Any thoughts or info on this would be appreciated, as I suspect I'm
using the wrong one.

Thanks.
- Jeff
_______________________________________________
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: Is there a convention...
      • From: Chris Hanson <email@hidden>
  • Prev by Date: Re: NSTableView rows and delete key
  • Next by Date: Memory allocation questions
  • Previous by thread: Re: Putting NSToolbar in an NSView...
  • Next by thread: Re: Is there a convention...
  • Index(es):
    • Date
    • Thread