Coding standard: Prefixing variables to indicate datatype

James J. Besemer jb at cascade-sys.com
Fri Jan 17 04:00:14 EST 2003


Jonathan P. wrote:

> I first encountered Hungarian notation in a Byte article
> written by Simonyi himself.  Couldn't make much heads or 
> tails out the article and frankly was annoyed at how
> complicated it seemed (and how much grief it gives to the
> programmer).  That annoyance at the article turned to 
> real world frustration when trying to program for Win32.  
> The idea of Hungarian notation as practiced by Microsoft 
> is really _ugly_.  

I always hated it too.  I find that merely picking good names for classes is 
usually sufficient if not superior.

However, in all fairness to Simonyi, he developed Hungarian notation 
literally decades ago, at a time when C compilers did not do any type 
checking and yet the types of variables mattered greatly.  It was easy to 
mistake ints and floats or much worse chars, char pointers and ints, with 
disastrous results.  In fact, I think he used it for assembly language 
programming before he used it for C.  In the absence of any substantial 
abstraction constructs and in the context of a very type unsafe environment, 
Hungarian wasn't such a crazy idea.  I personally STILL don't think it was 
worth the effort -- then or now -- but in the context of the time it wasn't 
so crazy as it may seem today.

Regards

--jb

-- 
James J. Besemer		503-280-0838 voice
2727 NE Skidmore St.		503-280-0375 fax
Portland, Oregon 97211-6557	mailto:jb at cascade-sys.com
				http://cascade-sys.com	







More information about the Python-list mailing list