ASP Best Practices |
To make the intended use of a variable clear to others reading your script, use three-character prefixes in lowercase to indicate data type. Even though explicit data typing is not supported in either VBScript or JScript, the use of such prefixes is recommended.
For consistency in naming variables, use initial capital letters in variable names. Do not capitalize prefixes. For example, to denote the data type of the variable named “SwitchOn” as Boolean, use the prefix “bln,” as found in Table A.2, to name the variable “blnSwitchOn”.
Table A.2 Suggested Prefixes for Indicating the Data Type of a Variable
Data Type | Prefix |
ADO command | cmd |
ADO connection | cnn |
ADO field | fld |
ADO parameter | prm |
ADO recordset | rst |
Boolean | bln |
Byte | byt |
Collection object | col |
Currency | cur |
Date-time | dtm |
Double | dbl |
Error | err |
Integer | int |
Long | lng |
Object | obj |
Single | sng |
String | str |
User-defined type | udt |
Variant | vnt |
To keep variable name lengths reasonable, use standardized abbreviations. For clarity, keep abbreviations consistent throughout an application or group of related applications.
Instead of:
strSocialSecurityNumber
use:
StrSSN