1. Discuss why naming conventions are important and why programmers should consistently follow them. Include in this discussion problems that could arise in naming variables if one convention is not followed.
2. Why is it important to consistently follow coding rules and techniques? What are the pitfalls of not doing so?
Any addition references will be greatly appreciated.© BrainMass Inc. brainmass.com June 3, 2020, 5:36 pm ad1c9bdddf
It is always good practice to use suggestive variable names that will assist in the documentation of a program. A good convention for variable names can often assist someone in better understanding the operation of a program module or script. For example, a good variable name should indicate its use, like "ErrorMessage" or "InputBuffer". Also, if the variable has several different uses, it can be split up into several different variables.
To illustrate the point of the problems that could arise for not following some convention take a look at the following code snippets
a) l = l + 1;
b) This = That + O;
c) const int TWENTY_EIGHT = 28;
d) #define FALSE TRUE
Another worse example would be the use of lower-case L or uppercase o as variable names, especially in combination.
e) int a = l;
if ( O = l )
a = O1;
l = 0;
Look for a comprehensive guide to C++ naming conventions
Variable naming and code layout/style in general, can result in some never-ending discussions. In the end, it doesn't really matter what style/standard you use, as long as you stick to it. If you're comfortable with a style, use it. Just don't get religious about it. When you start developing professionally, chances are you'll end up in a place where the coding-standard says something ...
Elaborate discussion on various topics including:
Variable Naming Conventions
Coding rules and techniques.
Advantages and Disadvantages of Sequential file access