Use a Naming Convention
Name your variables and other identifiers with something descriptive enough that you will not have to track down what it is for the next time you look at your code.
Date : 2006-06-23
It is very important to be able to recognize your variables and function names at a later time. Some of this comes down to always using the same names for your identifiers but it is also important to have some helpers or reminders built into your names.
Some common habits are using the first characters of an identifier to describe it's "type". For instance you could add an "i" to the begining of all integers, an "s" to all strings.
A similar rule can be applied to function names. I like to add "is" to the name of all functions that test for compliance with a set of rules. Surely you've seen functions such as:
Having these standards in your function names, along with having a standard returned type will go a long way to making your code easier for you as well as others to use and comprehend. For instance with all of these "is" functions you will want to return a simple True or False. Switching from 1/0 to True/False will only confuse things. Pick one and stick to it.
As will most coding methods there is a lot to be gained from uniformity. The more standard you make your code the faster it will be to write, maintain, and decode.
No comments yet