enough of accessors - how about private method naming conventions in the real world?
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.