Before any project or system development, you must customize a development convention and rule, which facilitates Unified overall style, code maintenance, and expansion of the project. Due to the decentralization, independence, and integration of web project development
Therefore, it is particularly important to customize a complete set of conventions and rules. This document will customize a series of conventions and rules, including the component team, folder naming rules, file name naming rules, Program Generation
Code programming style and database design conventions. These rules and conventions need to be discussed and customized with developers, designers, and maintenance personnel. In the future, development will follow the rules or conventions. Each team should develop its own
We have a set of specifications. A good and feasible specification can help us get twice the result with half the effort. None of these specifications are the only one. There are no right or wrong standards, there may be some areas that contradict your current habits.
Both parties are controversial. For example, many people are used to using auto-increment fields when designing databases, while some (people like me) are resolutely opposed. Each of them has ample reasons to express their views, therefore
To use the corresponding policy.
Obviously, web project development involves front-end and back-end development. Front-end development mainly refers to non-program programming, and is mainly responsible for website AI design, interface design, and animation design. Background development mainly involves programming.
And website operation platform construction, its main responsibility is to design the website database and website function template implementation. The following specifications are mainly customized from these two aspects. These specifications are summarized in my work over the past few years.
With a little experience, this document is suitable for the development specifications of Small and Medium websites or web projects.
1. Build a development team
The first thing after taking over the project is to build a team. A team can have dozens of members or a small team with only a few members according to the project size. The Team division should contain six roles, which are mandatory.
Project managers, planners, artists, programmers, code integrators, and testers are required. Maybe there are no more than 6 members in your team. It doesn't matter that one person can have multiple roles. For example, the project manager can also plan this
Roles, such as programmers, can also include code integration and testing roles. If your project is large enough, you can divide your project into six groups. The following describes the details of these six roles.
Responsibilities.
The Project Manager, the overall project design, the customization and monitoring of the development progress, the customization of the corresponding development specifications, the review of each link, and the coordination of development between members (groups. Planning, providing detailed planning
Analysis of solutions and requirements. It also includes planning for website promotion in the future. Artist: Design website AI, UI, and logo based on planning and requirements. Programmers design databases and functional modules based on the overall project design
. The Code integrator is responsible for integrating the code and interface of the programmer. The Code integrator can create pages related to the website. The tester is responsible for testing the program.
2. Development Tools
Web development tools are mainly divided into three parts: The first part is the website front-end development tools, the second part is the website background development environment, and the third part is the project management and auxiliary software. The following describes the software used for these three parts.
Website front-end development mainly refers to Web interface design. Including the establishment of the overall website framework, commonly used images, Flash animation design, and so on. The main software used is Adobe Illustrator, ADODB Photoshop, Dreamweaver MX, and Flash MX.
Website background development mainly refers to website dynamic program development and database modeling. The main software used is:
Powerdesigner (Database Modeling) is widely used in database design. It allows you to quickly create database concepts and physical models.
It is too convenient to generate a database report. It is strongly recommended to design a database. Rational
Rose (program modeling), if your project's functional modules are not particularly complex, it will save some time and development complexity, however, I personally think that both large projects and small projects should
Draw a rose diagram.
Website project management mainly controls the development progress and code version. The development progress is determined by Microsoft Project, and the code version control adopts Visual
Sourcesafe, of course, has other options such as CVS and rational clearcase. Microsoft
Application Center Test, which can be used for parallel and load testing. The program documentation is written in word. If you are very nostalgic, you can also use WPS.
3. website development process
Before the project starts to be implemented, there should be a work step, that is, the work flow. The most time required for project development is the overall design and system testing, and the time for coding is not much, however, some teams
I am eager to develop and write code. I will write the program first and then I will not pay attention to the review and test processes. As a result, this will cause rework, I have encountered this situation many times in a large company. So don't rush to the Project
To start code writing, we should take it step by step. Only when the process is slow can we go far and steadily. Figure 1 shows the entire development process.
Figure 1
As shown in figure 1, we can see two main lines: foreground development and background development. The front-end and back-end development did not overlap in the early stages of project development. Of course, they are not absolutely absent. Both web planning and requirement analysis are
They are related to each other. One is website presentation and style planning, and the other is website function planning. They are the relationship between clothes and trunk. At the end of the development stage, the interface and functional modules need to be combined to form a unified
1. The website to be released.
4. Database Development
The data file name adopts the system name + _ + file type. For example, if the system name is kupage, the database file is named kupage_database.mdf. Some database files have multiple
Such as SQL
There are two server files, one is a database file and the other is a log file. Their files are named respectively
Kupage_database.mdf, kupage_log.log. All file names are in lower case.
Database Table naming rules: The table name cannot exceed 30 characters. The table name contains all words in the singular form. The first letter of a word must be in uppercase, and no connection symbol is required between multiple words. If the library contains multiple systems
System: The table name is a system name + word or multiple words. The system name is short for the development system. All system names are lowercase English characters, such as bbstitle and bbsforumtype. If
The table name contains only one or more words. Select one or more English words that can summarize the table content, such as userinfo and usertype. Join table naming rules
It is re_table A _ table B, and RE is the abbreviation of relative, such as re_user_articletype and re_user_formtype.
Database field naming rules: database Field names are all lowercase English words separated by "_". The naming rules are table alias + word,
For example, user_name and user_pwd. Table alias rules. If the table name is a word, the first 4 words of the alias are used.
Two letters. If the table name is two words, take the first two letters of each word to form a four-letter long alias. If the table name is composed of three
To create a 4-letter alias.
The view name uses rule VIEW _ Table A _ table B _ Table C, and view indicates the view. When several tables are generated in this view, use "_" to connect the names of several tables. If there are too many tables, you can simplify the table name properly, but you must list all the table names.
Stored Procedure naming rules: P _ TABLE name_access procedure name (abbreviation), such as p_user_del and p_articletype_adddata.
Rules for writing SQL statements. keywords must be capitalized. For other statements, follow the naming rules described above. For example:
Select user_id, user_name from user where user_id = 'Tom'
5. Folder file name naming rules
Folder names are generally in English and generally contain no more than 20 characters. Except for special cases, Chinese Pinyin is used. Some common folder names are as follows: Images
Files), flash (storing Flash files), style (storing CSS files), scripts (storing JavaScript scripts), Inc (storing
Include files), links (store links), and media (store multimedia files.
The file name must contain lowercase letters, numbers, and underscores. The guiding ideology of naming principles is that you and every member of the Working Group can easily understand the meaning of each document.
When we use the "sort by name" command in a folder, files in the same category can be arranged together for us to search, modify, replace, and calculate the load.
1. The name of an image is divided into two parts: the beginning and the end. The names are separated by underscores (_). The headers indicate the main categories of the image, such as advertisements, logos, menus, and buttons.
The banner is the banner.
The iconic image is named: logo
We name a small image with a link on the page as a button.
On the page, a location appears consecutively. The image of the same link bar is named menu.
The photos used for decoration are named pic.
The image without a link is named title.
The following are examples: banner_sohu.gif, banner_sina.gif, and menu_aboutus.gif.
、Menu_job.gif, title_news.gif, logo_paie.gif, logo_national.gif
、Pic_lele.jpg.
2. The name of a Dynamic Language file. The description can contain multiple words separated by "_". The nature is generally the summary of the page.
Example: register_form.asp, register_post.asp, topic_lock.asp
6. program code programming specifications
A good coding style is conducive to system maintenance, and the code is easy to read and troubleshoot. Only the programming style and conventions of ASP are discussed here. All variables in ASP are weak variables, which can be directly used without definition.
And the code is case insensitive. But other languages are generally defined. In order to develop good programming habits, you must follow the rules below to write code.
1. Each variable name must be defined. Add the statement <% option explicit %> at the beginning of the ASP file to force each variable to be customized.
2. For the purpose of easy reading and consistency, use the following variable naming conventions in the Code:
Child type
|
Prefix
|
Example
|
Boolean |
Bln |
Blnfound |
Byte |
Byt |
Bytrasterdata |
Date (time) |
DTM |
Dtmstart |
Double |
DBL |
Dbltolerance |
Error |
Err |
Errordernum |
Integer |
Int |
Intquantity |
Long |
LNG |
Lngdistance |
Object |
OBJ |
Objcurrent |
Single |
Sng |
Sngaverage |
String |
Str |
Strfirstname |
3. The program code needs to be indented. The Tab key is used for indentation, and the Space key is not used. And "=" or the link string must be left and right blank, as shown below:
<%
Strmessage = "hello"
Strmessage = strmessage & "you are bad"
%>
4. Conventions for writing functions. The function or process naming uses Action + nouns. Each function requires corresponding comments, function functions, input variables, and the author and modification of relevant information. See the following function:
<%
'[Function] returns the value of a parameter.
'[Parameter] strparametername parameter name
'[Author] icefire 2002/8/20 AM
Function getparametervalue (strparametername)
Dim objrs, strsql, strparametervalue
Strsql = "select parametervalue from damsparameters where parametername = '" & strparametername &"'"
.
.
.
Getparametervalue = strparametervalue
Set objrs = nothing
End Function
5. asp built-in objects are case sensitive. The following code snippet
Strusername = request. form ("username ")
Set conn = server. Createobject ("ADODB. Connection ")
6. A database can only have one database connection file to connect to a database. The principle of creating a database object is to open the database as late as possible and close the database as early as possible. Create a database object call and create a function in a unified manner. As follows:
Sub openconn (byref conn)
Dim strdbpath, strdbconnection
Strdbpath = server. mappath ("database/tax. mdb ")
Strdbconnnection = "driver = {Microsoft Access Driver (*. mdb)}; DBQ =" & strdbpath
Set conn = server. Createobject ("ADODB. Connection ")
Conn. Open strdbconnnection
End sub
7. Release object resources when an object is not in use, such as objfso and objrs objects. Unified function call is used. The function is as follows:
Sub closeobj (byref OBJ)
If isobject (OBJ) then
OBJ. Close
Set OBJ = nothing
End if
End sub
8. All the time is saved to the database in the form of a string. In this way, the date can be well saved in different databases, and it is convenient for database migration. The time is saved as a 14-bit string, and the date is saved as an 8-Bit String.