The New Hungarian Notation
Posted by Marios Alexandrou, Project Manager in Information Technology NewsA lot of development environments are case sensitive. Even some databases are set up to be case sensitive. And there are the operating systems such as Unix that are case sensitive. What I've never been able to understand is what value case sensitivity offers. Up until now, no one has provided a satisfactory answer.
And while I've yet to find an answer to why case sensitivity was first created, I've now come across a useful way to make use of case sensitivity. During a pre-recorded discussion about .Net that I downloaded from the DotNetRocks site, Chris Sells called case sensitivity the New Hungarian Notation. That's an interesting idea. He suggested that within a class, private or local variables would be the lower-cased versions of something. Unfortunately, Chris Sells didn't spell out what that "something" would be, but there's a glimmer in my head as to how using case-sensitivity would be useful when programming.
A previous post of mine on .NET naming conventions touched on this subject. In particular, Microsoft has recommended that Hungarian Notation be dropped in favor of camel-case.
Entries (RSS)
Camel case is useful to developers looking at code that someone else has written. Often a developer can tell what's going on in their own code although that abilities diminishes when that same developer reviews code they've written months or years ago.
When communicating verbally, it is fairly easy for a well-spoken developer to provide the necessary context to achieve the same effect as using camel case. Now all you need to find is a well-spoken developer
So what is the advantage of camel-case?
I realize camel-case is used in Java to differentiate an instance from a class. But it is meant for the eye and not the ear. Programmers, in general, do not communicate enough in speech, and when they do, they are generally not clear. If I hear "truckLoad," do I know right away whether the speaker is referring to "TruckLoad" (the class) or "truckLoad" (the instance). No. And many programmers will not take the trouble to make the distinction in conversations, thus leading to misunderstandings.
Borland Pascal (and later, Delphi) tried to solve this with the "T" convention: TTruckload would be the class, and TruckLoad would be the instance. Pascal, as you know, is not case-sensitive. In discussion, when I hear TTruckLoad, I know it's a class. Now, I don't like this solution either, but I don't have a better one, other than suggesting that developers take the trouble to speak with more detail.