Jan Skibinski <[EMAIL PROTECTED]> wrote:
> But there are some stylistic camps, such as Eiffel's, that
> prefer names with underscores rather than Hungarian notation
> - claiming exactly the same reason: better readability. :-)
I don't see that underscores serve readability in the same way as Hungarian
notation purports to (unless the Eiffel people claim that underscores
somehow convey type information?), so I don't see a conflict here. One could
easily use both, e.g. n_widget_count for an integer value.
Whether underscores are better than mixed case, or whether Hungarian
notation is useful, seem to be matters of personal taste, not of fact. I
personally don't see much advantage to either underscores or mixed case
(except in C++, where many programmers tend towards such lengthy names that
the use of mixed case instead of underscores is actually helpful in keeping
identifier lengths under control). I use Hungarian notation only in C/C++,
and only when writing specifically for MS Windows, simply because that's the
convention on that platform (all of MS's documentation and samples use it).
I tend to think (getting off topic here) that Hungarian notation is fairly
useless; I'd rather know something about the scope of a variable (e.g. is it
a global? file-static? class member? static class member? local? static
local? In C++ there are so many possibilities! And that's not even
considering "const", "mutable", "volatile"...) so that I can see what the
variable relates to and how widely-felt the effects of changing it might be.
One company I worked at a few years back had a cute prefix scheme for this:
non-static member variables were prefixed "my" (i.e. owned by a single
object), static members "our" (i.e. shared by a class of objects), globals
and file-statics "the" (i.e. there can only be one), and locals "a" or "an"
(depending, of course, on whether the variable name began with a consonant
or a vowel). In practice, this seemed to my then-co-workers and me to be far
more helpful than Hungarian notation.
Craig