Practical Standards for Microsoft Visual Basic .NET (Pro-Developer)
[Previous] [Next]
Chapter 6
Programming often involves manipulating variables. Most procedures contain at least one variable, and some have dozens. Because variables are so common, they're often taken for granted. In Chapter 4, "Naming Conventions," I discussed using Hungarian prefixes to denote the data types of variables. Although using these prefixes should be mandatory, it's only the beginning of properly handling variables. A well-defined variable has a clearly defined data type and scope. In addition, to correctly use variables you must explicitly declare them using intelligent variable names and you must give them focus.
Goals of Using Variables Appropriately
The goals of explicitly declaring variables and using a consistent variable-naming scheme are
- Making the purpose of each variable clear
- Making the data type and scope of each variable clear
- Making the processes in your code easier to understand
- Making debugging easier
- Making the storing and processing of variables more efficient