Next tip...
Most developers, when looking back at code they wrote just a few months ago,
have a very tough time understanding what, exactly, they were doing! Part of
the reason old code is tough to read is because it usually lacks sufficient commenting.
In ASP (if using VBScript), you can easily comment using the apostrophe. Here is an example:
<%
' Create a variable to hold the user's name
Dim strName
...
%>
If you use JScript, you can comment using //. Here is an example:
<%
// Create a variable to hold the user's name
var strName;
...
%>
The question often arises, "When should I comment?" Well, there is no such thing
as "over-commenting," so if you think you should comment at a specific place,
do not hesitate to do so! A general rule of thumb is to comment when dimensioning
new variables, commenting any subs or functions, commenting on blocks of related
code (to explain the block of code's purpose), and commenting particularly difficult
or complex lines of code.
By commenting your code thoroughly, you'll greatly increase the ease of maintainability
of your ASP applications. Commenting is somewhat of a lost science, and while no
one likes to take the time needed to type out comments, it does make it easier
and less painful in the long run. One approach I've found helpful is to first
write out the comments for an ASP page, like pseudocode, then go back and write
the actual code.