Preventative Programming Techniques: Avoid and Correct Common Mistakes (Charles River Media Programming)
|
| < Day Day Up > |
|
The symptoms of i are:
-
Code that requires redundant comments to make it clear what the code is doing.
-
Code that cannot be easily parsed in one pass similar to reading ordinary language.
-
A name that is not understandable without the surrounding context.
To prevent i:
-
Use auto-completion and code templates available in most major editors to make writing fully understandable names easier.
-
Follow standard naming conventions.
-
Choose names that make the code read closer to everyday language.
To cure the effects of i:
-
Read existing code that you are incorporating into your project to look for names that could be made more understandable.
-
When possible, change names to match the comments until the comments are no longer necessary.
|
| < Day Day Up > |
|