ASP Development Specification
One, single page writing specification:
Remember that the page should be divided into modules to write:
First module: Receive parameters. [It is possible to submit from a different page to the same page, or there may be two form items to which priority is processed.]
Second module: Define global variables.
The third module: Write processing code (as far as possible to include the code in the function, see page note one). --The main part of this ASP code is completed.
Module four: Pure HTML code that uses values stored in global variables to generate pages.
V (note): To write the page logic at the head of the page. (How to receive and process.) )
Advantages: Easy maintenance. The modules are independent and easy to reuse to similar pages.
Second, the whole station document Construction specification:
1. After the project takes over, watch the static page, master the logic and browse the order.
2. Make an embedded file where the page is reused.
3. Extract the header file, the tail file, and the left menu bar to make the embedded file.
4. Divide the page structure and make template files. -Copy it later in the production, then you can make it directly.
Note: Do not rush to write a page, unless you take over a small project, or the user needs are very clearly determined and will not change, otherwise, it is very important to maintain the readability of the page code! (How do you feel when you face a big rework?) Think about the potential dangers first! )
--Because each of us is very clear about the code we write, it's hard to read the code that someone else has written. And, because of the change of customer demand, it is more common to modify or even overturn the original design. So pay attention to the writing code in the attention to let the latter quickly read, and easy to modify. ] [At least add comments to the page header, and in the important part of the code, it's also necessary to add some explanatory notes.] ]
All we do is simply to: increase portability reusability, make logic clear, facilitate maintenance,
See Tau no stretchers eel with aftertaste ⒕ "Yan illustrations Sang straighten mold α?"
――――――――――――――――――――――――――――――――――――――
Note One: The third module is written. ASP page Authoring Structure
1. Write the comments first
2. Write the embedded file.
3. Write chunks of ASP code (removed from COM)
-Note: complex pages, try to encapsulate different COM operations in separate functions;
--there is a call at the end of the function, and the data that is processed by the function is read directly in the subsequent page (assigned to the global variable)
--Check the validity of the page entry parameters before invoking the function.
Note two: Fourth module writing instructions. The HTML code section needs attention
1) It is best not to confuse the ASP code of the page with the HTML code--it feels rather confusing.
2) The results of ASP processing are obtained by obtaining the data of global variables.
3) About client-side javascript:
Verify the legality before submitting the form. Write in the drop-down box to have and hide the button to synchronize, write out a separate small function, placed below the button.
For large innerHTML-type client interaction operations, the code is written in the corresponding write client script, you can write more functions, so that the parameters passed between functions simple, functional, so that there will be similar pages later, you can tear it down and then use.
---------------------------------------
Requirements for Web authoring:
Web page staff to complete the pages, in order to ensure that there will be no confusion when using, ask them to do the following:
1. Do not nest too many forms;
2. The width of the table should be defined by the pixel width;
3. On a single page, a function module is made into a table so that when the page is written, the repeating part is extracted into an embedded file.
4. Other notes: Streamline the code, and note the width of the characters and borders in the table.
5. Name the filenames in English lowercase plus numerals (and half-width underscores). [Think about the horrors of your page moving to UNIX hosts]
>>> 5. Name the file names in English lowercase plus numerals (and half-width underscores). [Think about the horrors of your page moving to UNIX hosts]
This, which had not been noticed before, I was so named:
Editnews.asp
Delnews.asp
It seems to be written
Edit_news.asp
Del_news.asp a little better.
----------------------------------------
Let me also add a few code specifications:
1. Many people do not notice, but also I would like to recommend: on both sides of the operator, please write one more space. Try to compare:
A= (b*c/d+3.243) & "sdfsdfsdflkj" & "ASDSD"
And
A = (b * C/D + 3.243) & "sdfsdfsdflkj" & "ASDSD"
The readability difference. It is self-evident.
2. The code should be properly indented according to logic!
Example:
If a = 3 Then
Response.Write "Test"
Else
Response.Write "SDFSDF"
End If
"-------------> Note here, keep a blank line between the two logical statement blocks
Do and not rs.eof
Response.Write "Test"
Rs. MoveNext
Loop
Examples of errors:
If not rs.eof then
Response.Write "a"
Else
Response.Write "SFLDFSD"
End If
If a = 1 Then
If B = 2 Then
c = "Sdfkgkgskldf"
If d = "Dfs" then
E = "SDF"
End If
f = "SDLKFSLDFK"
End If
For i = 0 to 100
Response.Write I
Next
End If
According to my observation, the above code habits of the People in the ASP programmer accounted for at least 80%, I said no exaggeration.
Let's see if you can read the above code. Anyway, I see this as a big head.
As for the amount of indentation, see personal habits. It usually uses 2 or 4 cells. I personally generally asp/vb 2 lattice, js/c style with 4 grid
Annotation + indentation + specification naming
The above three points are really important
--------------------------------------
All tabs are indented, and the editor with a better indent can be set
Try not to output HTML code in Response.Write
Do not use option Explicit, personally feel that this feature does not apply to the Web
In the case of development programs, using the DREAMWEAVERMX development program should be able to speed up the development of some programs (such as Asp,php,javascrit, etc.), because there are highlighting and the function of the symbol hint.
Photoshop is a great tool when it comes to page design. PhotoImpact is also a good page design tool.