Friday, November 16, 2007

Commenting Code

There's a simple practice that you can begin using today which is guaranteed to make your web site work more organized and more professional: commenting your code.

I'm sure you're familiar with the HTML comment, which looks like this:

<!-- This is an HTML comment. -->

There are also comment tags specifically for use in CSS files, and in .asp, .cfm, .php, and .js files.

Any characters which are placed between those opening and closing tags will be completely ignored by all browsers. So they can be used for notes written in plain English which explain the reason why something is coded the way it is, where you got the code you used, or on what date you added it.

I've found that, when I take the time to do this, and come upon my comments months or years later, I'm always appreciative of the extra information.

I try to comment my code in such a way that someone else could benefit from my comments as well. A true professional will always think in terms of his work potentially becoming the responsibility of another web developer at some point, and do whatever he can to make that person's work easier.

0 Comments:

Post a Comment

<< Home