Rob said:
Lol, Barry, some points taken and I do appreciate you time for making those
points. My days of low level stuff like mov ah,4c int 21 and vtables are
long gone Now it's high level all the way, not time to play.
Lucky you. I work on compilers now, both Win32 and .NET - I can't escape
the MOVs.
I've always had the "Guidelines for Names" in my VS Help Favorites although
I've never seen any reason why not to prefix. All I see is things like "Do
not use a prefix for field names. For example, do not use g_ or s_ to
distinguish static versus non-static fields.".
Yes, but those apply to public fields (which ought to be rare, if ever -
properties etc.). You can do whatever you like in private, and whatever
other people on your team can tolerate in internal.
Then again I can always buy
the book "Framework Design Guidelines: Conventions, Idioms, and Patterns for
Reusable .NET Libraries" that the MSDN refers to.
Most of the naming content (for example) is available in the SDK
guidelines, but it does collect together a lot of other info that is
spread out in blog postings etc. over the past few years. I didn't learn
a huge amount from it, but it's definitely worthwhile to bring it all
together. There are a few nuggets of info in the annotations too.
By "outside" I meant outside the class. They are still protected in the
derived class.
Sure. The larger point I suppose I was making is that when your classes
aren't sealed, you're designing for two different users: people who
instantiate the class, and people who derive from the class. I think too
many people overestimate how "protected" protected is - it isn't really
"protected" at all, only slightly less public. For example, invariants
still need to hold with protected methods (or be very well documented),
there can't be any less-secure methods in there, etc.
Don't get me started on virtual methods; that's even worse, because
there are two sides - the implementer and the caller, and the caller may
be the class itself, where the implement or might need to deal with
invariants not holding etc. Implementing virtual methods and esp.
documenting them is not that easy.
-- Barry