> + ASP development specification

xiaoxiao2021-03-05  30

In order to standardize the program code, improve code readability, reduce post-maintenance costs, improve office efficiency, and programs prepared afterwards will be conducted in the following specifications:

First, unified VBScript and ASP program preparation specification:

(1) Variable naming rules:

Since the ASP and VBScript do not need to declare variables, it is not necessary to declare the type of variables, but in order to improve the readability, develop habits, the variable naming rules developed for this system are as follows:

1. Use DIM, public, private declared variables;

For example: DIM ISTUDENTNUM

2. Reference in variable type:

a, integer variable: start with lowercase letters, back with variable markers, the first letter of English words.

For example: the following declarations a variable that stores database records

DIM IRESORDSETNUMBER

B, single-precision entity variable: start with lowercase letters F, back with variable markers, the first letter of English words.

C, double precision entity variable: start with lowercase letters D, back with variable markers, the first letter of English words should be capitalized.

D, character type variable: beginning with lowercase letters;

e, Boolean variable: starting with lowercase letters B;

f, array variable: array type "_" "array" "_" "variable marker"

For example: Define an array of storage student scores (storage single precision entity type variable)

DIM F_ARRAY_STUDENTMARK

3. Variable markers should comply with the label standard, which is easy to understand, try to use English words to replace, try to avoid using abbreviations or shortcomings.

For example: Storage Alumni Address Book is defined as:

Dim sschoolfellowaddresslist;

Although this definition is more troublesome when input, it greatly improves the readability of the program, and seeing its variable name. It is also convenient when doing variables. Speed ​​and performance can always be two full. In order to facilitate the latter, we only have sacrificial speed.

4. Annotation defined after variable definitions.

(2) Constant naming rules:

The type is embodied above, the same place is that all the latter markers are all capitalized, for example:

Define a character type constant for a stored language type:

Const Slanguage_type = "Chinese"

(3) Function function, process naming rules:

1. Use the function declaration function to declare the process with the SUB;

2. The first letter of the function name or process name, and the first letter of the first letter behind.

E.g:

Function CheckValidityOfinput (SSTUENTMARK)

'Write code here

..........

END FUNCTION

3. The function name or process name is easy to read, simply.

4. Add a comment in front of the function, describe the function, parameter description, create dates, modify the date, modify the reason, create information about people, modify people, etc.

(4) Code indent standard:

In order to improve the aesthetic and readability of the code, the layout prepared by the code is proposed here: The interval and the interval are spacing in one .

E.g:

'********************************************************** **********

'Features: Detect single quotes in the input string, if there is, turn the original single number into two

'One single quotation mark, two becomes four, push it according to the class, so that the SQL statement is executed. 'Created: xxxx

'Creating time: 2002-7-6

'Change the time:

'Modify reason:

'Modify:

'Input Parameter Description: SINPUTSTRING: String of single quotes detected

'********************************************************** **********

Function CheckValidityOfinput (SINPUTSTRING)

DIM ICIRCTITIONCONTROL 'control loop

DIM SAPARTSTRING 'Separation Character Detection

DIM ilenofinput 'Enter a character length

Ilen = len (Trim (SINPUTSTRING))

For icrculationControl = 1 to len

IF MID (SINPUTSTRING, ICIRCTITIONCONTROL, 1) <> "'"

Sapartstring = SapartString &_

MID (Trim (SINPUTSTRING), ICIRCTIITIONCONTROL, 1)

Else

Sapartstring = SapartString & "''"

END IF

NEXT

CheckValidityOfinput = SapartString

END FUNCTION

Second, unified JavaScript program preparation specification:

The naming rules of JavaScript are the same as most of the above, the only different places are: variables use var to declare, end with a semicolon (;) after the declaration is completed.

The code code requires a clear level. This is written in the next line to write, do not complete all the code in a row, which looks not easy, check the error is also available.

Remember the content of the addending when you write a function, so that you can quickly understand the program functionality during maintenance.

Here is a JavaScript program: