Remember Me
forgot your password?

Using Comments in Your Programming Source Code by Nicholas Brown

At some point every programmer has experienced it; returning to code written days or months before, you find yourself unable to remember why you wrote the code the way you did and what it was for. Nothing can be more frustrating or more time consuming than having to step back through code and figure out what was going on. There is, however, a way to reduce the risk of this happening again. Adding comments to your source code may seem like a waste of time now, but when you have to go back to a chunk of code months down the road, you will be very thankful you took the time to add a few explanatory comments.

 

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!

Nicholas Brown

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.

Rate this Article: 0 / 5 stars - 0 vote(s)
Print Email Re-Publish

Add new Comment



Captcha

  • Latest Programming Articles
  • More from Nicholas Brown

Mobile antivirus software is beginning to be an essential

By: brookepens | 25/12/2009
When it comes to our home computers and networks in the work place everyone ensures that they are protected by mobile antivirus software with protective firewalls. Unfortunately, there are still many people and businesses that do not realise that mobile phone antivirus software has become just as important to have as antivirus computer software.

NetOffice Customization

By: Digisha Modi | 25/12/2009
NetOffice is a web based project management tools written in PHP and utilizing MySQL. It has a surprisingly easy to use user interface, and it really is self explanatory, even for first time users. It has the same features as most other free web based project management tools but is set apart from the pack by its simple layout and amazing ease of use.

SugarCRM Development Services

By: Digisha Modi | 25/12/2009
SugarCRM is commercial open source Customer Relationship Management software that is designed to meet all the CRM requirements of organizations. It is developed using PHP and available in both free and commercial editions. It provides basic CRM functionality such as lead tracking, sales management, project management, issue tracking etc.

Magento - Best Choice for Ecommerce Solution

By: Digisha Modi | 24/12/2009
Magento eCommerce is a new Open Source platform with industry-leading features to provide merchants with unprecedented control over store operations. This Open Source eCommerce software is very powerful and includes many features that have not been seen in Open Source products before. Magento eCommerce is one of the fastest growing new software, and looks set to become a dominant force in the eCommerce industry.

iPhone Web Applications: Try the Indian Firms for More Profits

By: Arun Kumar | 24/12/2009
The Apple iPhone has changed the way we talk, communicate. It’s a device where the best of Apple can be seen in every feature. Be it its imaging feature or music capability, connectivity prowess or internet access facility, the device offers the optimum in every segment.

Excellent reports in Silverlight

By: chaudhary fahim | 23/12/2009
The reports that are done in Silverlight have a far reach as they are circulated on the internet.

Defining Digital Dashboard

By: chaudhary fahim | 23/12/2009
Traditionally ‘dashboard’ refers to the control panel located under the windscreen of a vehicle which displays instruments and controls regarding the vehicle’s operation.

IPhone Apps Development for Social Media

By: hardikm | 23/12/2009
On this earth every body wants to be noticed in the eyes of others. This tendency of human beings created a structure of the society itself. Till yesterday the media for social interactions were direct contact or on the telephone. But today people have tremendous resources to get together. Internet is one of them and it has given a birth of social media sites like Facebook, Twitter, etc.

Product Delivery: Think Like the Customer by Nicholas Brown

By: Nicholas Brown | 15/10/2008 | Customer Service
Tips and tricks on delivering a product or service that meets all of the needs of your client.

Ms Access Databases Don't Have to Look Unprofessional by Nicholas Brown

By: Nicholas Brown | 30/09/2008 | Databases
Tips and tricks to help maximize the usability of your database by improving the user interface.

Using Comments in Your Programming Source Code by Nicholas Brown

By: Nicholas Brown | 30/09/2008 | Programming
Save time and money by adding comments to your source code.

Increasing Small Business Productivity by Nicholas Brown

By: Nicholas Brown | 27/09/2008 | Small Business
Tips and tricks to help maximize business profits by increasing project efficiency and organization.

Importing External Access Database Tables Using Visual Basic by Nicholas Brown

By: Nicholas Brown | 18/09/2008 | Programming
A brief how-to on importing external database tables using Visual Basic code. This tool can help users to automate their databases, saving time and money.

Pulling Data From Multiple Tables Into a Single Query in Ms Access by Nicholas Brown

By: Nicholas Brown | 17/09/2008 | Databases
A brief how-to on linking multiple tables within a single query. With this tool, users can develop more complex queries, reducing the need for several queries. This will also reduce the size of the database making it more efficient and easier to navigate.

Becoming an Expert Ms Access Database Programmer

By: Nicholas Brown | 11/09/2008 | Programming
Tips and tricks on becoming your own Access database expert. Follow these guidelines and you will be well on your way to becoming a leader in database development.

Submit Your Articles Free: Signup
Article Categories




Use of this web site constitutes acceptance of the Terms Of Use and Privacy Policy | User published content is licensed under a Creative Commons License.
Copyright © 2005-2008 Free Articles by ArticlesBase.com, All rights reserved. (0.28, 6, w2)