Specification for ASP Development
One, one-page writing specifications:
Remember that the page needs to be divided into modules:
First module: Receive parameters. [It is possible to submit from different pages to the same page, or you can see which of the two form items is treated as a priority.)
Second module: Define global variables.
The third module: Write processing code (as much as possible to include the code in the function, see page note i). --Complete the main part of this ASP code.
Module four: Pure HTML code that uses the values stored in global variables to generate pages.
Five (note): To write the page logic on the head of the page. (How to receive and process.) )
Advantages: Easy to maintain. The module is self-contained and facilitates reuse to similar pages.
Second, the whole station file construction specification:
1. After the project took over, watch the static page, grasp the logic and the order of navigation.
2. Extract the site to be reused to make embedded files.
3. Extract the header file, the tail file, and the left menu bar, made into embedded files.
4. Divide the page structure, make the template file. --Copy it later in production, and then it can be directly produced.
Note: Don't be in a hurry to write a page, unless you're taking on a small project, or the user's needs are very clearly defined and won't change, otherwise, it's important to keep the page code readable! (How are you feeling when you face the big rework?) Consider the potential danger first! )
-Because each of us understands the code we write, it's harder to read the code that someone else writes. And, due to changes in customer demand, it is more common to modify or even overthrow the original design. So pay attention to write code when the attention of the latter to quickly read, and easy to modify. [At least add a note to the page header, which is important in the middle of the code, and it is also necessary to add some explanatory comments.) ]
All we do is just to: increase portability, make logic clear, facilitate maintenance,
Depending on the tau did not Cheng Eel with Qinglie ⒕ "Yan finish mulberry wasting stretch mildew α?"
――――――――――――――――――――――――――――――――――――――
Note I: The third module prepares a description. ASP page Authoring Structure
1. Write notes First
2. Write embedded file.
3. Write large 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, the data that is processed by the function directly in the following page (has been assigned to the global variable)
--to validate the validity of the page entry parameters before calling the function.
Note II: Note Fourth module preparation. Part of the HTML code that needs attention
1 It is best not to make the page's ASP code and HTML code mixed together,-feel more confusing.
2 Obtain the data of the global variable to get the processing result of ASP.
3 About client javascript:
Verify the validity of the form before submitting it. Write in the dropdown box to have and hide the button synchronization, write a separate small function, placed under the button.
For large innerHTML-type client interaction, the code is written in the corresponding write client script, can write more functions, so that the parameters passed between functions simple, functional single, so that there will be similar pages, can be removed and then used.
---------------------------------------
Requirements for Web page production:
Web page personnel to complete the page, in order to ensure that there will be no confusion in use, please do the following processing:
1. Do not nest too many forms;
2. The width of the table should be defined by pixel width;
3. Single page, a function module to make a table, in order to write the page, the duplicate part of the extracted into the embedded file.
4. Other note: Thin code, note the width of characters and borders in the table.
5. Name in English lowercase plus digit (and half-width underline). [Think about the horrors of your page moving to UNIX hosts]
>>> 5. Name in English lowercase plus digit (and half-width underline). [Think about the horrors of your page moving to UNIX hosts]
This, which had not previously been noted, I have been named like this:
Editnews.asp
Delnews.asp
It seems to be written
Edit_news.asp
Del_news.asp a little better.
----------------------------------------
I also want to add a few code specifications:
1. Many people did not notice, but also I would like to suggest: operators on both sides, please write more than one space. Trial comparison:
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. Code please follow the logic to correctly indent!
Example:
If a = 3 Then
Response.Write "Test"
Else
Response.Write "SDFSDF"
End If
'-------------> Note here, keep a blank line between two logical statement blocks
Do as 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 people in the ASP programmer accounted for at least 80%, I say is not exaggerated.
You see, the above code, can understand. Anyway, I see this as a big head.
As for the amount of indentation, look at personal habits. The most common use is 2 or 4 lattice. Personally, I'm asp/vb 2, js/c style with 4 lattice.
Annotation + indent + specification naming
These three points are really important.
--------------------------------------
tab indents, and the editor with a good number of indents can set
Try not to output HTML code in Response.Write
Without option Explicit, individuals feel that this feature is not available for web
In the case of development programs, DREAMWEAVERMX developers should be able to speed up the development of some programs (such as Asp,php,javascrit, etc.), because of the highlighting and indicator features.
If it's page design, Photoshop is a good tool. PhotoImpact is also a good page design tool.