9 程序
a. 程序编码力求简洁,结构清晰,避免太多的分支结构及太过于技巧性的程序,
尽量不采用递归模式。
b. 编写程序时,亦必须想好测试的方法,换句话说,”单元测试” 的测试方案应
在程序编写时一并拟好。
c. 注释一定要与程序一致。
d. 版本封存以后的修改一定要将老语句用/* */ 封闭,不能自行删除或修改,并要
在文件及方法的修改记录中加以记录。
e. 程序中每个block 的开头 ”{" 及 "}” 必须对齐,嵌套的block 每进一套,
缩进一个tab,TAB 为4个空格,block类型包括if、for、while、do等关键字引出的。
f. 对于比较大的方法,每个block 和特殊的方法调用,都必须注明其功能.
Variable definition :
Variable type Definition way
1. String str + Xxx
2. Integer int + Xxx
3. Long lng + Xxx
4. Object obj + Xxx
5. Array arr + Xxx
6. Double dbl + Xxx
7. Single sgl + Xxx
8. Boolean bln + Xxx
9. DataSet ds + Xxx
10. SqlDataReader dr + Xxx
12. SqlDataAdapter da + Xxx
13. SqlCommand comm + Xxx
14. SqlConnection conn + Xxx
15. SqlTransaction Tran + Xxx
16. FileStream fs + Xxx
17. BinaryWriter bw + Xxx
18. Exception ep + Xxx
19. SqlParameter para + Xxx
20. DataTable dt + Xxx
21. DataRow dr + Xxx
22. DataColumn dc + Xxx
23. BinaryReader br + Xxx
24. Collection col + Xxx
25. DataGrid dg + Xxx
26. DataGridColumn dgc + Xxx
27. DataGridItem dgi + Xxx
页面控件命名规则
控件名 控件命名 例子
Label lbl + Field Description lblSupplierCode
RadioButtonList rad + Field Description radActive
TextBox txt + Field Description txtSupplierName
DropDownListBox drp + Field Description drpSupplierGroup
ListBox lst + Field Description lstSupplier
Button btn + Field Description btnSave
ImageButton img + Field Description imgSupplier
DataGrid dg + Description dg_searchResult
CheckBox chk + Field Description chkMon
I. Naming convention
0. General
0. Nouns are in single
1. No abbreviation
1. Variable names in HTML and Database & file/program names
1. All in lower case
2. Words are separated by "_"
3. Variable names in HTML and database should be the same if they mean the same thing.