The Evil Hungarian Notation

Hungarian Notation is a variable naming convention invented by Charles Simonyi. It comes in two flavours:

  • Systems Hungarian Notation, in which a prefix is used to encode the underlying representation of the identifier, for example dRadius to indicate that the radius is represented as a double presision number (i.e. prefixed with a “d”)
  • Apps Hungarian Notation, in which a prefix is used to indicate the purpose or nature of the identifier, for example strName – the prefix indicates the variable is a text string but does not indicate how the string is actually represented (e.g. in C++ it could be a zero terminated C-style string, or an std::string from the standard library)

The form Microsoft used to use in their example code for Windows was a mixture of the two forms.

Hungarian Notation has always been one of my pet hates among programming practices. When I’ve met people who think it’s a good idea – and there have been many of them over the years – it has always amused me that if you ask them why they like it, they will (without realising it) tell you exactly why it’s a bad idea! For instance, they’ll tell you it helps you to know what’s what in a long piece of code; of course, they are oblivious to the fact that it is long pieces of code that causes the problem, and that HN is not a solution, just sticking plaster that lets people think they don’t have a problem that needs solving. The real problem is that most programmers out there seem to think that long stretches of code – not disciplined by being broken up into appropriately named functions – are both normal and acceptable. The truth is that when functions are used to discipline the code, it is easy to see what’s what because declarations are never far away from where identifiers are used.

The above is the main reason I think HN is pure evil! That is, because its use is indicative of a bigger and more important problem that is likely to go unnoticed. That is, people are using HN to solve the wrong problem! Moving on though, here are other reasons not to use it:

  • In the case of System HN the prefix exposes representation, which as the code evolves over time may well change. The prefix then ends up lying. Ironically, the HN prefixes – in long stretches of code – do not let programmers off looking at declarations anyway. One can never really rely on the HN prefix being correct
  • The HN prefix is a wart of the code face! It presents an obstacle the brain must get past when parsing the identifier name. The drag factor introduced by such impediments to the understanding should not be underestimated!

Note that Microsoft haven’t been using or recommending the use of HN for quite some time now. Programmers out there, please, please let HN go the way of the dodo. Instead:

  • Choose your identifier names carefully so the name implies purpose. This is far more beneficial to the understanding than any prefixing system
  • Use the facilities provided by your programming language – functions, structures, and if you’re using an object oriented language, classes – to bring discipline to your code, such that understanding it follows naturally

Leave a comment

?>ungloryhole.com ungloryhole college rules rubs a huge cock collegerules Aiden Aspen Special Exercises tugjobs camel toe publicinvasion shaved pussy hammered collegerules pussy pounded VINTAGEGAYLOOPS smacked those asses trannyland Gia Malone Stephanie Cane bait Bus GynoOrgasmVideos Milf cravers publicinvasion submit your bitch public invasion Nude sport videos itsgonnahurt its gonna hurt Bareblacking tug jobs haze him outinpublic collegerules.com Kat drills submityourbitch Confession Of Married Man Latina pornstar pussy SpecialExercises fat mature redhead sexy blonde petite Aiden Aspen Vince Ferelli CODYCUMMINGS Alexis Fawx NEXTDOORPASS Sexy big tits pornstar itsgonnahurt itsgonnahurt outinpublic Licking Dick And Ass fat asses publicinvasion NEXTDOORPASS dildo drills her pussy busty adventures collegerules.com pussy covered hazehim bang pas facialfest porn star fucked hard pussy licked NEXTDOORBUDDIES lesbian dildo drilling publicnude outinpublic.com ungloryhole VISCONTITRIPLETS lucky stud in a hot threesome Ice La Fox tugjobs Brooke Banner Blonde round ass hazehim.com public invasion ungloryhole public invasion fat juicy ass. Big Mouthfuls Angelina Valentine submityourbitch Lacey lounging tranny land lesbian lover licks public invasion fucking ass and pussy haze him milf lessons Roxy Love TOMMYDXXX out in public public invasion publicinvasion public invasion tight ass drilled Lesbian sport videos facial fest assparade amazing blowjob Big tit fucked NEXTDOORHOOKUPS outinpublic submityourbitch milfsoup publicinvasion public invasion collegerules outinpublic.com Summer Bailey collegerules.com GAy Cumshots Extrem college rules Lesbiansportvideos submit your bitch fuck team five milfsoup natural beautiful tits magical feet BIGGEST ASS CRAVING Nudesportvideos bangbus submityourbitch summer time milf MedicalFemdom tranny land outinpublic.com Special Examination Medical Femdom Amy Reid submityourbitch.com outinpublic NEXTDOORMALE evanrivers outinpublic Monsters Of Cock MALEDIGITAL publicinvasion Gyno Orgasm Videos Bang Bros SpecialExamination haze him collegerules.com hazehim hottest white girls tranny land firm tits publicinvasion itsgonnahurt un glory hole CIndia Summers publicinvasion Redhead BBW 3DS Max 8 OEM3Q 3GP Video Converterdownload acdsee manager 2009 oemred eye remover pro 1.2cheapest windows vistacheapest windows vista ultimatecheap AutoCAD 2009Vision Backup Enterprisecheap Macromedia ColdFusionnero photoshow 5 downloadadobe photoshop cs oemcoldfusion mx 7 downloadkamagra sildenafil citratekamagra generic viagraorder caverta onlinecaverta 100buy cavertatadaliscasodex 50 mg tablet