Posted on Thursday 24 November 2005 - Popularity: unranked
An interesting article on how to improve code readability and understandability by using a variable naming convention known as the Hungarian Notation.
I guess every programmer was once told to use meaningful variable names in whatever code they are writing. If we add meaning to our variable names we can greatly improve readability and make our code easier to understand for fellow developers and for ourselves in case we end up looking at code we’ve written quite a while ago. Adding meaning to variables by means of using descriptive names is one thing but we can quite easily take this a significant step further.
The basic idea is to add a prefix to each variable (object, class …) that lets you easily know what kind of variable you’re currently using. So for example $nAge is a numeric variable and $sName is a string. Additionally you can add an additional prefix for the scope of the variable, for example $p_nAge is a numeric function parameter.










