On 05.06.2016 16:56, Jerry Stuckle wrote:
> On 6/5/2016 9:07 AM, Alf P. Steinbach wrote:
>> On 05.06.2016 14:36, David Brown wrote:
>>>
>>> Somewhere along the line, MS got the idea of "Hungarian notation"
>>> totally mixed up - it went from a good idea that was useful for safer
>>> programming (such as prefix "ss" for safe strings and "us" for unsafe
>>> strings), especially in weak typed languages, into a way to uglify code,
>>> prevent proper typing, and hinder maintenance and improvements to code
>>> (such as prefix "C" for classes, "pwsz" for pointer to wide strings,
>>> etc.).
>>>
>>>
>>> (I don't know details of the history of MFC, but presumably many of the
>>> design decisions were due to limitations of the C++ language and the
>>> MSVC compiler at the time, plus the chaos of the underlying Win32 API.
>>> I am not saying that MS did a bad job here, merely that it is not a
>>> library or style to be copied now.)
>>>
>>
>> As far as I know the Hungarian notation was originally in support of the
>> help system in Microsoft's Programmers' Workbench IDE.
>>
>> I don't know where to find this info now, in particular as there were at
>> least two other Programmers' Workbench.
>>
>> I think I saw it in Petzold's Programming Windows 3rd edition or
>> thereabouts, where he discussed logical fonts or something.
>
> Hungarian Notation was around long before MS's IDE (and not restricted
> to C). At least back in the 70's. Petzold did use it, but he wasn't
> first by any means.
Uhm, this view isn't factually incorrect, but it's irrelevant.
We were talking about Microsoft's Hungarian notation, which was the
first (and hopefully only ever) widespread use of it.
The /name/, “Hungarian”, refers to origins of the Microsoft chief
architect who invented it, and yes, he did that long before joining
Microsoft, namely Charles Simonyi, who was born Hungarian. In an
¹interview in 1986 he explained the notation name this way:
<quote>
It's called "Hungarian" as a joke. You know they say, "That's Greek to
me," meaning they don't understand it, so it might as well be written in
Greek. "Hungarian" is a twist on that phrase because these naming
conventions are actually supposed to make the code more readable. The
joke is that the program looks so unreadable, it might as well be
written in Hungarian. But it's a set of conventions that controls the
naming of all quantities in the program.
</quote>
Wikipedia's ²article about the notation does mention that “the original
Hungarian notation … was invented by Charles Simonyi”, but somehow the
authors of that article failed to catch on to the fact that he is
Hungarian, or that Hungarian sounds like Greek to most people, and
invented a silly explanation about the order of first name and surname
in Hungarian – such is the standard of this Wikipedia article.
Anyway, apparently Simonyi wrote an influential ³internal Microsoft
memorandum about the notation, which caused it to be adopted as a
standard in Microsoft's application division in the early DOS days.
Note: the first IBM PC and DOS appeared in 1981, so that sets the time
frame for the first serious adoption, and in particular the adoption in
Microsoft, which we discussed. Then Petzold included a description of it
at the start of his “Programming Windows” book, which introduced it to
the masses via the Windows programmers. I think it's not so important
that Petzold also used it, but you're right that he did.
Cheers & hth.,
- Alf
PS: Please don't quote signatures or other irrelevant stuff, thanks! :)
Links:
¹
http://web.archive.org/web/20020606140621/http://shamit.virtualave.net/charles_simonyi.htm
²
https://en.wikipedia.org/wiki/Hungarian_notation#History
³
https://msdn.microsoft.com/en-us/library/aa260976%28VS.60%29.aspx