![]() |
|
|
Published: Thursday, October 29, 1998
Why Use Coding Conventions?
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:
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:
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: 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!
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||