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.

Finance Developer (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume

Published: Thursday, October 29, 1998

ASP Coding Conventions
By Scott Mitchell


Why Use Coding Conventions?
The primary reason to use coding conventions is to increase the readability and maintainability of your ASP code. Most developers cannot decipher their own code around six months after it has been written and last used. By religiously adhering to a strict set of coding guidelines, code is easier to read and understand.

- continued -

Good code is self-documenting code. This means that your code should use variable names which reflect both their data type and purpose. Functions should have meaningful names as well. Your SQL tables and column names should be meaningful as well. For example, here is an example of hard to read code:

'Good code starts with Option Explicit
Option Explicit

Dim x,y,z
x = 4
z = 3
y = f3(f1(x) + f2(z))

One could not make heads or tails of this code without seeing the function declarations. This code could become self-documenting code with a few changes:

Option Explicit

Dim fBase1, fBase2, fHypotenuse
fBase1 = 3
fBase2 = 4
fHypotenuse = Sqrt(Sqr(fBase1) + Sqr(fBase2))

This code is much more readable, and it is obvious that we are finding the length of the hypotenuse of a right triangle given the lengths of the two bases. The "f" prefix denotes a float, or single, variable. Ardent VB programmers may not be familiar with it, since the floating point type is not denoted float, like it is in C.

Information on ASP Coding Conventions:
ASP has its own set of recommended guidelines, and Microsoft publishes such a list at http://msdn.microsoft.com/en-us/library/ms972100.aspx.

If you take the time to follow these conventions, your code will be easier for others and yourself to maintain. In theory this should make you more marketable. (Of course there is a certain amount of job security when you write code that only you can maintain!)

Happy Programming!


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