Compile development standard documents through instances

Source: Internet
Author: User
Tags microsoft sql server 2005
Chapter 3 website development section 1 website development basics I. Environment Construction

1. Microsoft Visual Basic 2005

2. Microsoft SQL Server 2005

3. Adobe Dreamweaver CS5

4. Adobe Photoshop CS5

5. Microsoft Office Visio 2003

Ii. Standardized Development

In this section, we will learn how to compile the development specification documentation. Why do we need to write development standard documents? Because our system development usually requires a team to develop, in order to make every member of the team form a unified development agreement. Standardized Documents can serve as a bridge between programmers and enhance program readability. Next, we will use the "China ski network" instance to learn to write standard documents.

The structure of the Development specification document is similar to that of the requirement document: 1. Develop the specification document for "China ski network"; 2. Contents; 3. Body of text. The following is the specific content.

 

Directory

Directory... 1

1. write the purpose ...................................... ........................................ ........................................ .................................... 2

2. program naming conventions ..................................... ........................................ ........................................ ............................... 2

Basic conventions ...................................... ........................................ ........................................ ........................................ ......... 2

Control naming rules ..................................... ........................................ ........................................ ........................................ .... 4

ADO. NET Control naming rules .................................... ........................................ ........................................ ................................ 5

Custom Control naming rules ................................... ........................................ ........................................ ...................................... 6

Type declaration ...................................... ........................................ ........................................ ........................................ ........ 6

Constant ....................................... ........................................ ........................................ ........................................ ............. 7

Class Name ..................................... ........................................ ........................................ ........................................ ......... 7

Abstract class definition ...................................... ........................................ ........................................ ........................................ ..... 7

Definition of the sealing class ..................................... ........................................ ........................................ ........................................ ..... 8

Definition of a method ...................................... ........................................ ........................................ ........................................ ....... 8

Virtual method definition ..................................... ........................................ ........................................ ........................................ ..... 8

The member definition of the class .................................... ........................................ ........................................ ........................................... 8

Structure Definition ...................................... ........................................ ........................................ ........................................ ....... 8

Structure member definition ..................................... ........................................ ........................................ ........................................ .. 8

Interface Definition ...................................... ........................................ ........................................ ........................................ ....... 9

Interface methods and member definitions .................................. ........................................ ........................................ .................................. 9

Customize the definition of an exception .................................... ........................................ ........................................ ........................................ 9

Annotation specification ...................................... ........................................ ........................................ ........................................ ...... 9

 

1. Writing Purpose

In order to make every member of the team form a unified development agreement, this document is formulated. In the future development process, please strictly follow the rules stipulated in this document for encoding. Through this specification, we hope to serve as a bridge between programmers and enhance the readability of the program.

If you encounter any rules not agreed in this document during use, the document will be supplemented and improved after discussion.

2. Basic Program naming conventions

L all naming names must use names that can directly express specific meanings.

You cannot use meaningless names such as X, Y, Z, and so on, except for cyclic variables.

L all member variables must be declared before all member methods and separated by a line break

For example:

Public class ClsLogin

{

TextBox txtUserName ;//

TextBox txtPassWord ;//

Public Login ()

{

}

}

L The Name Of The class file name must be able to reflect the content of the class, preferably with the same name as the class. A file only writes one class, and the names of files and folders should also accurately describe their usage.

For example:

File Name: Login. cs

Class Name: public class ClsLogin

L braces "{" need a new line.

Correct writing:

Public class ClsLogin

{

}

Error code:

Public class ClsLogin {

}

L The switch statement must have default to handle unexpected situations.

L external connection with the program (such as connecting to the database, interfaces, files, etc.) must capture any type of exceptions (try) and provide friendly messages to users, when necessary, use logs to record the error details, including the time when the error occurred, related methods, and class names.

L always use "{}" to include the statement under if/else, even if there is only one statement.

Correct writing:

If (true)

{

// Statement.

}

Error code:

If (true)

// Statement.

L separated the namespace of the referenced system from the custom or third party.

Using System;

Using System. Web;

Using System. Web. Security;

Using System. Web. UI;

Using System. Web. UI. WebControls;

 

Using MYNameSpace. NameSpace;

L separate functions or methods with empty rows.

For example:

Public class ClsLogin

{

Public Login ()

{

}

 

Public ~ Login ()

{

}

}

L The specific path and drive name are not used in the Code. The relative path must be used.

L use Tab rather than space for code indentation.

L use the value of a control to name local variables whenever possible.

Public string GetTitle ()

{

String StrTitle = lblTitle. Text;

StrTitle + = StrTitle;

Return StrTitle;

}

L one method only completes one task. Do not combine multiple tasks into one method.

L avoid using large files. If the code in a file exceeds 300 ~ Line 3: Separate the code into different classes.

Control naming rules

The following controls are commonly used control naming rules, which are listed in ascending order by English letters. The undefined controls in this list will be supplemented later.

Control Type

Naming prefix

Example

Panel

Pnl

PnlTtitle

Button

Btn

BtnLogin

Check box

Chk

ChkOk

Combo box

Cbo

CboInfoSort

Dropdown list box

Ddl

DdlCity

Data

Dat

DatUser

Control

Ctr

CtrInfo

Data grid

Dgd

DgdUserList

Data list

Dbl

DblInfo

Data repeater

Drp

DrpInfo

Directory list box

Dir

DirSource

Image

Img

ImgIcon

Label

Lbl

LblHelpMessage

Text box

Txb

TxbName

List box

Lst

LstInfo

TreeView

Tre

TreOrganization

 

ADO. NET Control naming rules

 

Type

Prefix

Example

Connection

Con

ConNorthwind

Command

Cmd

CmdReturnProducts

Parameter

Parm

ParmProductID

DataAdapter

Dad

DadProducts

DataReader

Dtr

DtrProducts

DataSet

Dst

DstNorthWind

DataTable

Dtbl

DtblProduct

DataRow

Drow

DrowRow98

DataColumn

Dcol

DcolProductID

DataRelation

Drel

DrelMasterDetail

DataView

Dvw

DvwFilteredProducts

 

Custom Control naming rules

When registering a Custom control, you must declare it as "Custom.

For example:

<% @ Register TagPrefix = "Custom" Namespace = "CustomComponents" %>

Use Time:

<Custom: CreditCardForm runat = "server" ID = "customCreditCard"/>

Type Declaration

When a variable is defined, it is prefixed with a variable declaration character. In order not to conflict with the system control name, the first letter of the prefix is capitalized when the type name is used.

L integer

Type

Prefix

Example

Sbyte

Sby

SbySex

Short

Shr

ShrAverage

Int

Int

IntRowCounter

Long

Lng

LngBillGatesIncome

Byte

Byt

BytPixelValue

Ushort

Ushr

UshrMoney

Uint

Uint

UintCount

Ulong

Ulng

UlngCount

L floating point type

Type

Prefix

Example

Flost

Fot

FotMoney

Double

Dou

DouMoney

Decimal

Dec

DecMoney

L Bool type

Type

Prefix

Example

Bool

Boo

BooIsPostBack

L character type

Type

Prefix

Example

Char

Chr

ChrSelectSex

L Reference Type

Type

Prefix

Example

Object

Obj

ObjReturnValue

String

Str

StrName

 

Constant

In uppercase, words are separated by "_", for example, USER_PASSWORD.

Class Name

The class name must start with the Cls prefix.

For example:

Public class ClsTextBox

{

Public void DataBind ()

{

}

}

Abstract class definition

The abstract class must start with the AbsCls prefix.

For example:

Public abstract class AbsClsTextBox

{

}

 

Seal class definition

The seal class must start with the SeaCls prefix.

For example:

Public sealed class SeaClsTextBox

{

}

Method Definition

In case-sensitive format, it is generally named as a verb-object phrase.

For example:

ShowDialog ()

CreateFile ()

Virtual method definition

Add the Vir prefix to the method definition to indicate the virtual method.

For example:

Public virtual string VirShowDialog ()

{

}

Public virtual string VirCreateFile ()

{

}

 

Class member Definition

Reference Type Declaration;

Structure Definition

The structure name must start with the Srt prefix.

For example:

Public struct SrtDimensions

{

Public string StrName;

Public string StrPassword;

}

Structure member Definition

Reference Type Declaration;

Interface Definition

The interface name must start with an I prefix.

Interface ICompare

{

}

Interface methods and member Definitions

Refer to the class methods and member definition rules.

Custom exception Definition

The custom Exception type starts with the Cls prefix and is named with Exception as the suffix.

Example:

Public class ClsMyException: Exception

{

}

Annotation Specification

1. The comments must contain Chinese and Chinese Punctuation Marks.

2. the maximum length of each line comment cannot exceed 1024*800 width and must be aligned with the code.

3. Separate the comment and comment separator with a space.

4. write comments while coding.

5. Important variables must be annotated.

6. Variable comments and variables must be aligned on the same line. There must be at least two tabs separated from the variables.

7. Annotations must be added to typical algorithms.

8. comments must be written in the loop and logic branches.

9. Comment the program segment or statement on the previous line of the program segment or statement.

10. Temporary or irrelevant comments must be deleted before code delivery.

File and function comments

1. Both the file and function header must have an overview comment.

2. The overview comment of the file and function should be indented with one space.

3. The file overview comment information must include the following:

A) file name

B) attributes

C) creator

D) creation date

4. Function overview comments must include the following:

A) Functions

B) enter a parameter to indicate the meaning and type.

C) Return Value, indicating meaning and type

D) Author

E) creation date

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.