zhongguo168a 发表于 2013-1-29 07:52:22

读AS3官方版FLEX SDK代码规范的摘录

原文地址:
http://opensource.adobe.com/wiki/display/flexsdk/Coding+Conventions
 
读此文章,总结出一些原则和规范,并记录下来,大家有兴趣的话也可以读读,如果错误或争议之处,请指出。多交流多进步。
 
1. 尽量避免使用缩写,名字长点没关系,最重要的是要让人看懂。当然在项目中约定的缩写是可以使用的,例如以下是flex sdk的一些缩写约定。
 
<div class="quote_div">Avoid them as a general rule. For example, calculateOptimalValue() is a better method name than calcOptVal().

And if you don't abbreviate, developers won't have to remember whether you shortened a word like “qualified” to “qual” or “qlfd”.

However, we have standardized on a few abbreviations:

acc for accessibility, as in ButtonAccImpl
auto for automatic, as in autoLayout
auto for automatic, as in autoLayout
eval for evaluate, as in EvalBindingResponder
impl for implementation, as in ButtonAccImpl
info for information, as in GridRowInfo
num for number of, as in numChildren
min for minimum, as in minWidth
max for maximum, as in maxHeight
nav for navigation, as in NavBar
regexp for regular expression, as in RegExpValidator
util for utility, as in StringUtil
页: [1]
查看完整版本: 读AS3官方版FLEX SDK代码规范的摘录