If you have decided to start investing time placing comments in your code, allow me to give you a few “pointers” that will allow your comments to have the greatest impact. The first thing I do is place myself in the position of someone who has never seen that particular code before. I try to imagine I am this person, trying to figure out what the code before me is intended to do. I start out at the beginning of the code with an explanation of what the overall code is trying to accomplish. This will give the reader at least some idea as to what the code is intended to do.
Next, I give a brief description of what each variable’s role is in the code (i.e. counter, output, etc.). The person reading the code could eventually figure out what each variable is doing, but it is easier if you just spell it out for them.
Finally, I add the date. This is an extremely important step. It is extremely likely that sooner or later you will need to make revisions or corrections to your code. By including dates, you and others can see which pieces of code are the newest and which are the oldest. This can be extremely beneficial when debugging programs. I add a date, never erasing previous dates, each time I begin working in a piece of code. I also include a brief description of what was changed and why. This makes for a great reference log for later.
Many programmers find themselves reusing their code in different situations. Adding comments can help locate those needed pieces of code more quickly, saving valuable time. The important thing to remember with comments is that it not only benefits others, but will greatly benefit you in the future. Happy commenting!
About the Author:
Nicholas Brown is a recognized authority on the subject of Access Databases. He is the founder of Database Technology Services (DTS). DTS is a leader in custom Access database development. DTS programmers create databases for corporations, small businesses and individuals. Visit www.dts-consultants.com to see all of the services DTS has to offer.





