CSC/ECE 517 Fall 2010/ch5 5b RR
Variable Naming Conventions
Almost all programming languages allow the programmer a great deal of freedom when naming variables in a program's source code. But choosing good names is hard. This is a tutorial on how to choose good variable names!
Introduction
Naming conventions is one topic in programming that has probably not been emphasized enough. There has always been a debate about its importance and effort taken to learn and follow them. Naming conventions make programs more understandable by making them easier to read. They can also give information about the function of the identifier-for example, whether it's a constant, package, or class-which can be helpful in understanding the code thereby reducing development time specially when the code is large.
As an example, say a variable holds the average age of students in a class. Int averageAge or int AverageAge gives a lot of information to the programmer about what the variable does than say just int a; Also capitalizing the very first letter of every word makes it more readable than just int averageage.
In this chapter, we are mainly going to look at some rules and guidelines to choose good variable names.