Programming, Hungarian style
Some years ago, following a debilitating illness, I started to fill the seemingly limitless days of convalescence by expanding my programming skills. “I’ll learn to program in Windows,” I said to myself, ever the optimist. Five years later, I’m still learning.
One of the stranger matters I had to get used to was the way the variable names in C programs for Windows were decked out in weird-looking prefixes: names like lpszFile, rdParm and hwndItem dotted every programming example I came across. In self-defence, and also through that curiosity about language which renders me totally incapable of resisting the printed word in any form (try getting me to walk past public notices on lamp posts — my wife has given up trying), I looked into its origins. I discovered that the system of naming variables that created such unpronounceable monstrosities was called Hungarian notation. This name turned out to be a double-decker pun of the type relished by computer programmers, who are almost to a person fascinated by wordplay and language. (Did you know that lexicographers and computer programmers share a psychological type?).
Firstly, and most literally and mundanely, the notation had indeed been invented by a Hungarian. His name is Charles Simonyi. He was born in Budapest in 1948, and for more than a decade he was senior programmer at Microsoft in Redmond. His invention of the notation dates back to the early seventies, however, and he used it during his degree work at Berkeley and later when he was working at Xerox PARC. He disliked the way that names in C programs could stand for any kind of variable. This was for ever leading to mistakes, as programmers tried to manipulate variables in ways that their type prohibited, and which they would never had done if they remembered what sort they were. “If only,” he thought, “the names of the variables themselves gave useful information about their type ...”. And so the idea of Hungarian notation was born, in which each variable is prefixed by lower-case letters indicating useful things about it.
He had the chance to implement his ideas when he joined Microsoft in 1981. The programmers there looked at the convoluted, vowel-less variable names produced by his scheme and, like everyone else who has come into contact with them since, must have said something like “This might as well be in Greek — or even Hungarian!”. They almost certainly had in mind as well another kind of mathematical system called Polish notation. They put the two together and made up the name Hungarian notation.
Originally just a joke, this name for the system has been generally adopted in the computing community, together with the system itself, by anyone writing Windows programs and has begun to spill over into other areas. It is still jargon, since the number of people you stop in the street who have heard of it will be vanishingly small (unless the street is in Redmond, of course).