ASP source program writing specifications
1 Introduction to the specifications
This specification mainly stipulates the rules and precautions that ASP source programs should follow during writing. The purpose of writing this specification is to keep the source code writing habits of project developers consistent. Doing so that each group member can understand the code of other group members, so as to facilitate the secondary development of source code memory system maintenance.
2 General format specifications
2.1 Indentation
Indentation is the two spaces exposed to increase readability when the level of the source program changes. The rule of indentation is to indent four spaces for each level. Tab is not allowed. Because Tab will produce different effects due to different settings made by the user (if you are used to using spaces, you can set it in the editor to change Tab to four spaces). When entering judgment (If…Then, Select…EndSelect), loop (For[Each]…Next, While…Loop), With statement, function, procedure, class declaration, it is added one level, and when exiting judgment, loop, with statement, function, procedure, class declaration, it is reduced one level. For example:
CODE:
iTemp=0
If(iTemp<>100)Then
iTemp=100
EndIf
2.2 Line break
A newline is to add a newline to the beginning and end of a With statement. When the declaration of functions, procedures, and classes ends, add one. Line breaking is for the convenience of program debugging and more readable.
Example 1:
CODE:
i=0
DoWhile(i<10)
i=i+1
Loop
Response.Write(i&"<br/>")
Example 2:
CODE:
Classclass1
.....
EndClass
Classclass2
….
EndClass
Example 3:
CODE:
Functionfun1()
….
EndFunction
Subsub1()
….
EndSub
2.3 Spaces
Add spaces at both ends of operators and logical judgment symbols, for example:
CODE:
i=i+1
a=aAndb
sHTML=”abc”&sHTML
But no space is needed when adding brackets. For example:
CODE:
If(a>b)Then' incorrect usage
If(a>b)Then' Correct Usage
3VBScript grammar writing format specifications
3.1 Reserved words
The principle of retained words or keywords in VBScript language should be used in the first letter capitalization and the remaining letters lowercase (recommended). In addition, all lowercase methods can also be used, mainly to facilitate input source programs.
3.2 Processes and functions
3.2.1 Naming and Format
The names of processes and functions should all be composed of meaningful English words, and the first word is all lowercase, and the first letter of other words is capitalized. If there is only one word, the first letter is capitalized. For example: