When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles [1.x] [2.0]
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips
Search

Sections:
Book Reviews
Sample Chapters
Commonly Asked Message Board Questions
Headlines from ASPWire.com
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
Web Hosts
XML Info
Information:
Advertise
Feedback
Author an Article
Technology Jobs



















internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
ASP ASP.NET ASP FAQs Message Board Feedback ASP Jobs
Print this page.

Risk Developer - C# - T-SQL - ASP.Net (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume

Comment Your Code!


  • Back to Beginner's Tip Index
  • 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.

  • Back to Beginner's Tip Index
  • Next tip...


    Windows Internet Technology | ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article


  • The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers