Arguments against Hungarian Notation
David Mandala
plug-devel@lists.PLUG.phoenix.az.us
Tue May 7 13:41:26 2002
Rob Wehrli had some good points. From a personal point of view I have
used something like HN since the early 80's but did not know it as HN. I
evolved this method out of late night programming and tiredness.
I was tracking down some obscure bugs and I kept walking over them time
and time again. Why? Becasue I was copying data from one var to another
and woops truncating the data from a long to an int. Yes warning were on
and yes the compiler was yapping about it but I still could not see the
problem.
Once I finally "saw" the problem I started using my own shorthand to be
able to tell the type from the name, and forced my team to switch too.
Since that time certain classes of problems just don't happen and it had
been much easier to learn other peoples code.
I don't like the most recomended version of HN however. I prefer to use
an underscore between the type info and the name info. For me it is much
easier to read. Thus in C a char array is char ach_NameOfVar[100]; but I
also perfer to typedef other info at a deaper level so I rarely use
int's but int8, int16, int32, int64 ect. and my version of HN includes
that info too int32 i32_count; or unsigned int32 ui32_count. I may be
crazy but I want to know what my code is doing. I design it, and code it
to a spec, in order to know if I met the spec I need to fully understand
what it is doing. I don't even trust my compilers all the time,
sometimes I have have it spit out ASM code and I check the output for
correctness.
Some folks like it some hate it. I prefer using my form of HN for any
non-trivial programming project. If the language supports typed
variables I track the type, I never trust the compiler or run time
engine. To do so would be foolish or silly. But then again I still
perfer to use make files instead of an IDE. Generally I can't hang a
mouse over a var to tell it's type my test editor has no idea what the
text is beyond text.
Cheers,
Davidm
On Tue, 2002-05-07 at 10:37, Rob Wehrli wrote:
> On Sunday, May 05, 2002 5:52 PM, Kimbro Staken
> [SMTP:kstaken@xmldatabases.org] wrote:
> >
> > On Sunday, May 5, 2002, at 10:12 AM, Rob Wehrli wrote:
> > >
> > > Don't be a fool. The VB programmers at Microsoft (and many other
> > >
> >
> > Well wow, I'm so glad that I didn't get flamed or something. Nice, really
> > nice. Guess I should have stated that I've used both VB and hungarian
> > notation.
>
> Not meant to be a flame...don't read too much into it... :) Having stated
> your VB and HN use would have at least made it sound like you weren't
> flaming VBers. BTW...I didn't say that you were a fool, I simply cautioned
> you against being foolish... :) ...and, why cut off your original
> statement in the reply?
>
> Hungarian came out of Microsoft from the C and C++ world, I suspect VB
> people just picked it up out of imitation without really understanding
> what it was for.
>
> Just picked it up out of imitation (monkey-see, monkey-do) without really
> understanding (stupid or at least ignorant)...
>
[snip]