Re: grid



The notation was invented in the days before there was cross-boundary prototype checking
in the C compilers (pre-ANSI C). Also, HN as originally designed did NOT include the
representation type with the name; it used the LOGICAL CONCEPT as a type, but NEVER
anything as stupid as 'dw' was used (I got this from private email from a developer who
was there when it was invented, and who was part of the Word development team where it was
used, but doesn't want his name disclosed. He says that the Windows group saw HN,
completely missed the point of it, and misapplied it uniformly everywhere. I agree with
him. As designed, it would actually have served a useful purpose. As used in Windows, it
is merely noise, and often erroneous and misleading noise. Any programmer too lazy to
look up the declaration of a variable has deeper problems that HN won't solve.)

HN should be discouraged, and the total disregard of it in C# is a significant step
forward. HN as used in Windows is a colossal step backward, confusing the concept of
interface and representation. It was a mistake. It was a misapplication of what was
probably a reasonable idea in pre-ANSI compilers, but which is irrelevant in modern
programming. Between Intellisense and the browser, it is nothing more than a waste of
space and intellectual overhead. Think of the really, really, REALLY STUPID ideas, such
as the name 'wParam' being a 32-bit or 64-bit value, or 'lParam' being a 32-bit or 64-bit
value. We will ignore the huge number of failures in the PSDK, such as VOID psz, LPCTSTR
dw, and so on that are easily findable (I found at least 30 such errors with minimal
effort, which is 30 more errors than should have been allowed to exist. It is almost as
bad as the horror of naming fields in structs with prefixes that indicate the type of the
struct, such as tmHour, tmMinute, and tmSecond, a throwback to an exceptionally poor C
compiler, the K&R compiler, that declared all field names as global names, because structs
were an afterthought. This is the same design error that gave us "." and "->" as
different operators for the same concept, field access of a structure).

Therefore, whatever purpose it might once have served, it is largely irrelevant today.
Given how poorly it is used, it should be abandoned (consider BOOL fOption; if it is a
BOOL, it is not an f-type! f- is for Flags, meaning some bit pattern derived from |
logic. Or why is dwMask not fMask? Who CARES if it is DWORD declaration? The list goes
on and on...)

Microsoft adopted it and has a tendency to not let go of bad ideas, and did it to death.
Therefore, I consider its use in all Microsoft products as merely an example of how a
corporate tradition can propagate fundamentally bad ideas long past their useful lifetime,
and in any case since nearly ALL instances in Windows are a misuse of the original idea,
all uses in Windows are suspect.

I see no reason to continue to live with the mistakes imposed on us by obsolete and
irrelevant software. We are living in a world of C with prototypes and C++, and we should
live in that world, not the world of the mid-1970s or the mid-1980s. Otherwise, we should
all be programming in FORTRAN, PASCAL, and Algol-60. Our tools mature, and we should
mature with them, not carry obsolete methodologies around because they once had a purpose.
And we should certainly not carry around perversions of what may have been sound ideas at
the time.
joe

On Mon, 23 Apr 2007 08:53:10 GMT, MrAsm <mrasm@xxxxxxx> wrote:

On Sun, 22 Apr 2007 14:26:58 -0400, Joseph M. Newcomer
<newcomer@xxxxxxxxxxxx> wrote:

Hi Joe,

int iWindowWid, iWindowHei;
*****
Generally, it is good practice to avoid using commas in declaration lists. One variable,
one line. It would be a lot better use of the names if you eliminated the 'i' (which
conveys nothing useful) or the "Window" (which conveys nothing useful) and simply called
them "Width" and "Height", which would mean the meaningless abbreviations of the most
important part of the name would be eliminated.

So, it seems to me that you don't like the Hungarian Notation, or you
don't consider HN useful.
I agree exspecially for simple cases like integers and the "i" or "n"
prefix.

But, why was this notation invented?
And why Windows PSDK, and even some of the MFC and ATL sources [*],
use HN? Is HN important in huge projects?
(However, it seems that in the "new" C# world, HN has been discouraged
by Microsoft coding standards.)

[*] I downloaded ATL Server shared-sources:

http://blogs.msdn.com/vcblog/archive/2007/03/02/atl-server-shared-source-release-now-available.aspx
http://www.codeplex.com/AtlServer

and they use prefixes like sz, str, wsz, etc.

Thanks in advance,
MrAsm
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: grid
    ... in the C compilers. ... He says that the Windows group saw HN, ... compiler, the K&R compiler, that declared all field names as global names, because structs ... all be programming in FORTRAN, PASCAL, and Algol-60. ...
    (microsoft.public.vc.mfc)
  • Re: Windows Compilation Madness
    ... another long thread like this with all the problems windows users ... There are plenty of prevalent compilers, ... If the build-chain isn't predictable then it is ... a build environment on each and every Windows box what if the ...
    (comp.lang.ruby)
  • Compiler positions available for week ending September 16
    ... advertise a position having something to do with compilers and must also ... Software Design Engineer ... The Visual C++ team is working hand in hand with the Windows division ... on enhancing the appeal of Vista and Windows 7 for ISV developers and ...
    (comp.compilers)
  • Re: input & output in assembly
    ... there's no way of doing cin/cout in assembly. ... it fairly safe to assume your either using GEOS Ensamble, Windows ... The string *MUST* be terminated with a $. ... which in some C compilers means ...
    (comp.lang.asm.x86)
  • Re: input & output in assembly
    ... there's no way of doing cin/cout in assembly. ... it fairly safe to assume your either using GEOS Ensamble, Windows ... The string *MUST* be terminated with a $. ... which in some C compilers means ...
    (alt.lang.asm)