Code for design of vb.net programs (1)
Last Update:2017-02-28
Source: Internet
Author: User
Program | specification | Design INTRODUCTION: Kent Beck once said, "I'm just a programmer with a more focused program."
Directory:
Objective
Specification of descriptive documents
Specification for process annotations
annotation Specification for functions
Naming conventions
Design Specifications:
Foreword: 1. The importance of design specifications: Reason n More, not more
2. Applicability of this article: vb.net development asp.net development
The target of the annotation code:
1. Describe the role of clear code (what is done, not how)
2. Clearly explain the ideas and logic to be expressed by the code
3. Indicates an important turning point in the code
4. Reduce code readers ' running code in their brains
Note: Attention should explain the purpose of the code, not how to complete the structure of the goal, to explain why to do so, rather than how to do
Identify a note with a special character: the line at the beginning of the ' $ ' @ Represents the annotation code written by different people
A Descriptive file specification (written at the end of each. vb file header, description of the entire file function)
1.1 with '----------------------------------start and end
1.2 File name: file name
1.3 Author Author version: date and date of completion:
1.4 Description: The main function for detailing the completion of this program file, with other modules
The interface of the function, the output value, the value range, the meaning and the control between the parameters
A relationship of system, order, independence, or dependence.
1.5 Others: Description of other content
1.6 Function List: main function lists, each record should include function name and function brief description
1.7 History: Modify History list, each change record should include modification date, modify
and the revised content of the brief
1. Date:
Author:
Modification:
2. ......
Two Specification for process annotations
2.1 with '----------------------------------Start and end
2.2 Description: Functional description
2.3 Parameters: Parameter description
2.4 Calls: A function or procedure called by this procedure
2.5 Called by: Call the function manifest for this procedure
2.6 Table Accessed: Tables accessed (this entry is only for programs that are involved in database operations)
2.7 Table Updated: Modified tables (this entry is only for programs that are involved in database operations)
Three annotation Specification for functions
3. 1 Function: Functions name
3. 2 Description: Description of function function, performance, etc.
3. 3 Calls: List of functions called by this function
3. 4 called by: Call function List for this function
3. 5Table Accessed://accessed table (only for programs involved in database operations)
3. 6 table Updated://Modified tables (this entry is only for programs involved in database operations)
3. 7 Parameters://input parameter description, including for each parameter
The relation between the parameter and the value.
3. 8 return://function returns the description of the value
Four naming conventions
4. 1-Piece naming conventions
(1) Normal control
Example name prefix
AdRotator ADRT Adrttopad
Button BTN Btnsubmit
Calendar Cal Calmeetingdates
CheckBox chk Chkblue
CheckBoxList CHKL chkfavcolors
CompareValidator Valc Valcvalidage
CustomValidator Valx Valxdbcheck
DataGrid DGRD Dgrdtitles
DataList Dlst Dlsttiltles
Driopdownlist Drop Drop
Hyperlink Link Lnkdetails
Image img Imgauntbetty
ImageButton ibtn Ibtnsubmit
Label LBL Lblresults
LinkButton lbtn
ListBox LST
Panel PNL
RadioButton Rad
Radopbuttonlist Radl
RangeValidator Valg
RegularExpression Vale
Repeater rpt
RequiredFieldValidator VALR
Table TBL
TableCell TBLC
TableRow TBLR
TextBox txt
ValidationSummary Vals
XML XMLC
(2) Ado.net control naming
Connction con connorthwind (con + database name)
Command cmd cmdreturnproducts
Parameter Parm Parmproductid
DataAdapter dad Dadproducts
DataReader DTR Dtrproducts
DataSet DST Dstnorthwind
DataTable Dtbl dtblprpducts
DataRow Drow drowRow98
DataColumn Dcol Dcolproductid
DataRelation Drel Drelmasterdetaril
Dataview DVW dvwfilteredproducts
(3) The goal of variable naming:
1. Make a variable use clear
2. Make each variable's data type and visible range clear
3. Make the process in your code easy to understand
4. Making programs easy to debug
5. Make variables more efficient to store and process
Other see vb.net procedure Design Code (2)