IMO the biggest benefit of not using Hungarian is the fact it forces you to use meaningful names. If you are naming variables properly, you should immediately know what type it is or be able to deduce it fairly quickly in any well-designed system. If you need to rely on str
or bln
or worse of all obj
prefixes to know what type a variable is, I would argue it indicates a naming issue - either poor variable names in general or way too generic to convey meaning.
Ironically, from personal experience the main scenario I have seen Hungarian used is either "cargo-cult" programming (i.e. other code uses it, so let's continue to use it just because) or in VB.NET to work around the fact the language is case-insensitive (e.g. Person oPerson = new Person
because you can't use Person person = new Person
and Person p = new Person
is too vague); I've also seen prefixing "the" or "my" instead (as in Person thePerson = new Person
or the uglier Person myPerson = new Person
), in that particular case.
I will add the only time I use Hungarian tends to be for ASP.NET controls and that's really a matter of choice. I find it very ugly to type TextBoxCustomerName
or CustomerNameTextBox
versus the simpler txtCustomerName
, but even that feels "dirty". I feel some kind of naming convention should be used for controls as there can be multiple controls that display the same data.