• 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
enough of accessors - how about private method naming conventions in the real world?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

enough of accessors - how about private method naming conventions in the real world?


  • Subject: enough of accessors - how about private method naming conventions in the real world?
  • From: "Michael B. Johnson" <email@hidden>
  • Date: Tue, 06 Aug 2002 22:48:45 -0700

So we all know that Apple has coopted the "prefix your private methods with an underscore" idiom, and told us not to use it. Annoyingly enough, this is fair, since we don't have source to the Apple frameworks, and since any private methods one might implement using the same naming convention would silently override their particular implementation, leading to all sorts of nasty, hard to find bugs.

So what do *you* do when you want to have private methods in classes that you want to have the same freedom with (i.e. the clients of these classes, even if they have access to the source, don't want to be able to accidentally override your private methods).

I've recently moved from naming the private method "_foo" to naming it "_foo_".

Yuck.

But workable. I could live with this, I think, and my users could live with being told "do not name any of your methods like this". None of them would want to :-)

I do *not* want to do some sort of prefix akin to the class names (i.e. renaming _foo in BARBigCoolClass as _BAR_foo), but I realize that I need to publish whatever idiom I choose so that users of my classes now have two naming schemes they must avoid - Apple's and mine.

Any real world examples of how people are dealing with this? I'm less interested in academic answers than from folks who have done this and lived with it for a bit.

Thanks.


--> Michael B. Johnson, Ph.D. -- email@hidden
--> Studio Tools, Pixar Animation Studios
--> http://xenia.media.mit.edu/~wave
_______________________________________________
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: enough of accessors - how about private method naming conventions in the real world?
      • From: "Timothy J. Wood" <email@hidden>
    • Re: enough of accessors - how about private method naming conventions in the real world?
      • From: Hasan Diwan <email@hidden>
    • Re: enough of accessors - how about private method naming conventions in the real world?
      • From: Georg Tuparev <email@hidden>
    • Re: enough of accessors - how about private method naming conventions in the real world?
      • From: Nicholas Riley <email@hidden>
  • Prev by Date: Re: OmniObjectMeter and multiple NSAutoreleasePools
  • Next by Date: NSAutoreleasePool with java questions
  • Previous by thread: Re: iTunes values and Music Library.xml
  • Next by thread: Re: enough of accessors - how about private method naming conventions in the real world?
  • Index(es):
    • Date
    • Thread