选择专业的词
避免使用空洞的词汇
找到更有表现力的词
清晰和精确比装可爱好

避免泛泛的名字(或者要知道什么时候使用它)
避免像tmp,retval, foo这样的泛泛的名字
循环迭代器的变量名i, j, iter, it 作为多重迭代的变量时,为了避免索引歧义,可以用精确的变量名字


用具体的名字代替抽象的名字
在给变量,函数或者其他元素命名的时候,要把它描述的更具体而不是抽象
使用前缀或后缀来给名字附带更多的信息
为名字附带更多的信息

带单位的值 - 如果变量是一个度量,最好把名字带上单位


附带其他重要属性


决定名字的长度 - 名字不能太长
在小的作用域里可以使用短的名字首字母缩略词缩写 时候合适
原则:团队新成员是否能理解这个名字的含义
丢掉没用的词 -- 比如 ConvertToString 不如ToString
利用名字的格式来传递含义
c#:帕斯卡方式 命名类 方法,属性, 驼峰方式命名私有变量
其他格式规范
JavaScript: 构造函数用帕斯卡命名,普通函数用驼峰命名
jQuery: jquery 返回的结果变量也用 $前缀
html/css: 表示id的词汇用下滑线连接,表示class的用连接线连接