Website Development Naming Detail specification

Source: Internet
Author: User
Tags aliases

Objective

A good naming convention can contribute to teamwork, both in project development and in product maintenance. It should be said that the naming specification is a convention and a bridge of good communication between programmers. In addition, the ancients believed that knowing a person's real name would gain an incredible power over that person. By giving things the right name, it can lead to stronger power than code. If all the names are compatible with their nature, then the relationship is clear, meaning can be deduced, and the general presumption can be expected.

Note: Common English keywords See appendix: "Tian Jian website development file naming standard keyword dictionary"

first, folder naming rules

Folder naming is generally used in English, the length is generally not more than 20 characters, named in lowercase letters. Some common folder names such as: images (storing graphics files), Flash (storing flash files), style (storing CSS files), scripts (storing JavaScript script), Inc (storing include files), Link (store links), media (storage of multimedia files) and so on.

Ii. rules for the naming of documents

The file name is a combination of lowercase English letters, numbers, and underscores, beginning with the English alphabet. The guiding principle of nomenclature is to make it easy for you and each member of the workgroup to understand the meaning of each document, and the other is that when we use the "Sort by name" command in a folder, the same large class of files can be arranged together so that we find, modify, replace, calculate the amount of load, and so on.

1. The naming principle name of the picture is divided into the head and tail parts, separated by an underscore, the first part of this picture is a large class of properties such as ads, logos, menus, buttons and so on.

Placed in the top of the page ads, decorative patterns and other rectangular picture name: Banner Iconic image named: Logo

A small picture with a link on the page that is not fixed, and we are named button

In a position on the page in succession, the same nature of the link column picture we named: Menu decoration with the photo we name: pic

A picture without a link to represent a title we name: Title

Here are a few examples: Banner_sohu.gif, banner_sina.gif, Menu_aboutus.gif, Menu_job.gif, Title_news.gif, Logo_police.gif, Logo_ National.gif, Pic_people.jpg.

2. Dynamic language file naming rules Nature _ Description, description can have more than one word, separated by "_", the nature is generally the outline of the page.

Example: register_form.asp,register_post.asp,topic_lock.asp

Program Code Programming specification

A good program coding style facilitates the maintenance of the system, and the code is easy to read and error-checking. Only the programming styles and conventions of the ASP are discussed here. All variables in the ASP are weak variables that can be used directly without definition, and the code is not case-sensitive. But in other languages these are all defined, in order to develop good programming habits, write code must follow the rules.

1. Each variable name must be defined to add statements at the beginning of the ASP file, forcing each variable to be customized.

2. For readability and consistency purposes, use the following variable naming conventions in your code:

Sub-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 have indentation, indentation using the Keyboard tab key, do not use the space bar. and the "=" or link string needs to be left and right, as follows: <%

strmessage = "Hello"

strmessage = strmessage & "Welcome you to visit Aspid"%>

4. Conventions written by the Function procedure. A function or procedure is named with an action + noun, and each function needs to give a corresponding comment.

function functions, passing in variables, as well as author and modification related information. As the following function:

<% ' [function] returns the value of a parameter

' [parameter] strparametername parameter name

' [author] qingis 2005/7/29 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 fragment

strUserName = Request.Form ("UserName")

Set conn = Server.CreateObject ("ADODB. Connection ")

6. Database connection A library can have only one database connection file, and the principle of creating database objects is to open the database as late as possible and close the database as early as possible. Create a Database object call to create a function uniformly. 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. Dispose of object resources, such as Objfso,objrs objects, when an object is not in use. Use a unified function call. The functions are as follows:

Sub closeobj (ByRef obj)

If IsObject (obj) Then

Obj. Close

Set obj = Nothing

End If

End Sub

8. The time is all saved in a string format to the database, so that the date can be stored well in different databases and easily migrated to the database. Time is saved with a 14-bit string, and the date is saved with a 8-bit string.

Iv. Database Naming conventions

Data file naming takes the "system name _ FileName" type, for example, the system name is Aspid, the database file is named Aspid_database.mdf, and there are several database files, such as SQL Server has 2, one is a database file, the other is a log file, Then their files are named Aspid_database.mdf,aspid_log.log, respectively. Filenames are all lowercase.

database table naming specification, the table name can not exceed 30 characters, the table name contains all the words in the singular form, the first letter of the word to capitalize, the number of words without any connection between the symbols. If there are more than one system in the library, the table name takes system name + word or multiple words, system name is the abbreviation of development system, system name all use lowercase English characters, such as Bbstitle,bbsforumtype. If the library contains only one system, the table name uses only one word or multiple words. Words select one or more English words, such as userinfo,usertype, that summarize the contents of a table. The Guan Lianqua naming convention for re_ Table A_ table B,re is an abbreviation for relative, such as: Re_user_articletype, Re_user_formtype.

database field naming specification, database field names are all lowercase English words, between words with "_" separated, naming rules are table aliases + words, such as: User_name,user_pwd. Table alias rules, if the name of the table is a word, the alias takes the first 4 letters of the word, and if the table name is two words, the first two letters of the two words are composed of 4 letters long aliases, and if the table name consists of 3 words, you may want to take one from the beginning of the word and then remove the two letters from the last word. The result is a 4-letter long alias.

The view name takes the rule view_ table A_ table B_ Table C,view represents the view. This view is generated by several tables and joins the names of several tables with "_", and if you have too many tables you can simplify the table names appropriately, but be sure to list all the table names.

Stored procedure naming rules P_ the name of the Access procedure (abbreviated), such as P_user_del,p_articletype_adddata. SQL statement Writing rules, keywords must be uppercase, and other written according to the above naming rules, such as: SELECT user_id, user_name from user WHERE user_id = ' Tom '

Website Development Naming Detail specification

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.