已阅读5页,还剩42页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Eric Huang s Creative Studio Flex SDK 编码规范及最佳实践编码规范及最佳实践 注意 本文档目前还不完整且有些部分以TBD 待讨论 标记 但这对于起步已经足够了 引言引言 这篇文档拟定了用 AS3 编写开源 Flex 框架组件的编码规范 遵照这些规范可以使得源代码看起来组织良好 风 格一致并且更加专业 其中有些规范是很任意的 因为并非总存在一种 最好方式 来编码 然而 为了照顾一致性 的要求 所有付诸 Flex SDK 的项目都将遵循这些编码规范 目录目录 命名命名 缩写词 缩略语 单词定界 类型指定名 包名 文件名 命名空间名 接口名 类名 事件名 样式名 字符串属性枚举值 常量名 属性 变量和 getter setter 名 存储变量名 方法名 事件处理方法名 参数名 资源包名 资源键名 杂项名 语言用法语言用法 编译选项 基于属性的 APIs 类型定义 Literals Expressions Eric Huang s Creative Studio Statements Declarations 文件组织文件组织 Copyright notice package statement import statements use namespace statement Class metadata Class declaration include statement for Version as Implementation notes Class initialization Class constants Class mix ins Class resources Class variables Class properties Class methods Constructor Variables Overridden properties Properties Overridden methods Methods Overridden event handlers Event handlers Out of package helper classes 格式化格式化 Line width Indentation Section separators Separation of declarations Metadata Array indexing Commas Array literals Object literals Function literals Type declarations Operators and assignments Statements Eric Huang s Creative Studio Constant and variable declarations Function declarations Function calls if statements for statements switch statements class and interface declarations ASDoc 文档文档 Property comments 命名命名 缩写词缩写词 作为通用规则而避免使用 例如calculateOptimalValue 比calcOptVal 的命名方式更优 acc 代表 accessibility 比如 ButtonAccImpl auto 代表 automatic 比如autoLayout eval 代表 evaluate 比如EvalBindingResponder impl 代表 implementation 比如ButtonAccImpl info 代表 information 比如GridRowInfo num 代表 number of 比如numChildren min 代表 minimum 比如minWidth max 代表 maximum 比如maxHeight nav 代表 navigation 比如NavBar regexp 代表 regular expression 比如RegExpValidator util 代表 utility 比如StringUtil 编码时采用合适的命名既便于使用且理解起来也更为容易 所以你得在选择好的命名方式二 多费心力 特别是针对公共 API 提供出来的时候 Eric Huang s Creative Studio 我们的命名规范绝大部分和 ECMAScript 和 Flash Player 9 是一致的 表意明确比为了少敲几下代码而采用缩写更为重要 如果你不使用缩写 开发人员就不用非 得记住你是否采用了单词简写 如把 qualified 简写成 qual 或 qlfd 不过 我们已经标准化了一些缩写词 上述列表可能没有包含目前使用的所有缩写词 如果你用到了上面没有列举出来的缩写词 请搜索源代码看是否已经有相应的缩写词使用了 如果没发现 再考虑一下如果缩写是否合 适 在 Flex 中有各种缩略语 像 AIR CSS HLOC IME MX MXML RPC RSL SWF UI UID URL WSDL 和 XML 之类 一条缩略语要么全部大写要么全部小写 e g SWF 或 swf 但不会是 Swf 使用全部 小写的缩略语形式是当使用本身作为标识符或者作为某个标识符的开头 以及标识符需用 小写字母开头时 可以参照一下关于标识符到底以大写还是小写开头的规则一条缩略语要 么全部大写要么全部小写 e g SWF 或 swf 但不会是 Swf 使用全部小写的缩略语 形式是使用本身作为标识符或者作为某个标识符的开头 标识符必须以小写字母开头 可 以参照一下关于标识符到底以大写还是小写开头的规则 有时候由于不清楚一个单词组合是不是已经成为一个独立的新词了 所以这种情况下会出 现不一致的情况 deopdown popUp popUp 常常 对象最简单的名字就是它本身的类型 当然要采取和类型名不同的大小写方式 以小写字母开头然后接下来的单词采用首字母大写 controls listClasses 包名总是名词或动名词 动词 ing 的名词形式 而非动词 连词或副词 对于重要的 APIs 文件名必须要和公共 API 内部的名字一致 但是包含文件必须要遵从这 个规则 常量值如果是 string 类型的 那么它的 value 要和常量名保持一致 如果一个类重写了一个 getter setter 但还想继续公开基类的 getter setter 它就得单 独用一个属性 属性吗为基类中属性名前加一个前缀 这个 getter setter 要以 final 标 记且不做任何额外的 coding 除了调用 super getter setter 方法名应当总是动词 如果一个类重写了一个方法 但还想继续公开基类的方法 它就得单独实现一个方法 方法 名为基类中方法名前加一个前缀 这个 method 要以 final 标记且不做任何额外的 coding 除了调用 supermethod 避免 object 因为它意义模糊 一个 item 是一个 data item 而不是一个 DisplayObject Eric Huang s Creative Studio 一个 renderer 是一个显示 data item 的 DisplayObject 一个 type 一个 AS3 类型 否则使用 kind 这部分我们将讨论如何使用 AS3 的语言构造 尤其当同一事物存在多种表述手段时 建议使用基于属性的 APIs 而不是基于方法的 APIs 因为这些更加适合声明式的 MXML 编 程 为每个常量 变量 函数参数以及函数返回值甚至如果简单地使用 表明 无类型 如果你声明 Array 类型的变量 你得添加一个 of ElementType 形式的注释紧接着 Array 表明该数组元素的类型 未来版本的语言可能会支持这种类型化的数组 不要在 integar 中使用小数点 RGB 颜色值总是采用这种 6 位十六进制数表示 如果一个 Number 值可以是小数 则一般要加上一个小数点并补上 0 即使实际值是个整 数值 不过 对于像素坐标即使是小数形式 也最好使用整数值表示它 使用引号标记 双引号 而不是撇号 单引号 限定字符串 即使那个字符串包含一个引号作为 其内部某个字符 避免使用函数文本定义匿名函数 使用一个类方法或包函数替代 如果你必须使用函数文本 声明一个返回类型 在函数体内用一个分号终止最后一条语句 使用字面值而不是一个字符串构造的 RegExp 实例 使用字面值而不是 XML 构造函数形式 U 对于 XML 属性值使用双引号括起来 仅当存在导入类型歧义时才采用类名的全路径形式声明一个类 对于常用操作符如 such as 使用 语法提到 syntax instead on each reference to something in a non open namespace 如果 if else 的不同分支涉及到单条语句 不需要大括号包含它 但是如果有多条语句时可以将大括号包含起来 如果测试多个 error 检查 可以使用一系列 if 语句段测试错误并提前返回 正确的执行流 放到最后返回 true 不要使用嵌套的 if 语句来判断 这样会导致执行流整个块中都有 即使 for 语句块只有一条语句也要用大括号括起来 对于上限我们用一个单独的变量来存储 这样不会使得每次判断的时候都要重复计算 在循环括号里面声明循环变量 除非其他地方要用到这个变量 即使只有一条语句也要用括号括起来 即使一条语句也要括起来 t 将每一个 case 子句作为一个块 包括 default 子句 将 break 和 return 语句置于块中 将 default 子句也当做 case 子句 避免出现 case 穿透问题 Eric Huang s Creative Studio 不需要将返回值用括号括起来 从方法体中部返回也是可以的 不要在同一行声明多个变量或常量 在需要访问限定的地方放置上访问限定符 不要不写 虽然这样表示默认的访问限定 internal 在构造 public 或者 protected 的 API 时 仔细想想是否需要这样做 Public 和 protected 的 APIs 必须进行文档化 在正式被终止之前需要支持好几个发布版本 如果存在 请将这个关键字放在访问限定符之后 如果存在 将它放在访问限定符后面 所有的常量应该是 static 的 不应将一个实例声明为常量 应该所有的哦实例将使用同样 的值 如果变量需要初始化为一个值 而不是使用默认值 在声明变量的时候就初始化而不用等 到构造函数里面再初始化 如果一个类简单地继承自 Object 不用显示写出 extends Object 子句 如果一个类有实例变量 要书写一个构造函数 显示使用 super 即使它没做任何事情 不要在构造函数中设置类实例变量 在实例声明时就初始化 不过 如果你需要重置从父 类实例中继承的变量值 可以在构造函数中做 在包语句中中的公共 API 常常是一个类 有时是一个明明空间或函数 帮助类 空语句 这部分主要阐释 Flex 框架文件应当如何组织 在框架文件下每一个 as 文件头部都应包括一个版权声明 下面给出 2008 版开源版本的格 式 将类中元数据按 Events Styles Effects Excluded IPIs 和其它元数据顺序分成几个部分 在每个部分前面加一个小的说明头 注意每个说明头是 40 个字符宽度在 和其后 区块名之 间有两个空格 每个区块将元数据名 按字母表顺序排列出来 在其他元数据区块 将元数据标签名按字 母表顺序列出 将静态常量声明置于此 Eric Huang s Creative Studio ActionScript 3 不允许常量具有 Array or Object 类型 声明那种常量使用 static var 而不是 static const 将它们放在这个部分因为概念上它们也属于常量 将任何 Function 类型声明为静态变量而不是声明为方法减小类大小 声明静态 getters 和 setters 然后将它们按字母表顺序排列 使用 Declare static getters and setters here Order them alphabetically by property name Use a minor separator with the property name for each one Put the getter before the setter Only document the first function of a get set function pair for a property The idiom for defining and documenting a property is 有时我们 故意 采用的缩写词不一致 例如 我们在很多时候都会拼写 horizontal 和 vertical 像 horizontalScrollPolicy 和 verticalScrollPolicy 但是我们在常规容器类名 HBox 和 VBox 中却将它们缩写成了 H V 缩略语缩略语 和缩略语有关的标识符有CSSStyleDeclaration IUID uid IIME和imeMode 单词定限单词定限 当标识符包含多个单词时 我们采用两种方式表明单词界限 单词首字母大写 比如 LayoutManager measuredWidth 和下划线连接 比如object proxy 具体采用哪种方式请参照一下规则 即使出现两个缩略语相邻时也要遵循首字母大小写的规则 loadCSSURL 就是一个很符合这种情形的例子 实际上很少使用 但是尽量避免使用那样的名字 类型指定名类型指定名 如果你想要在命名中纳入类型标示 将类型作为最后一个 词 If you want to incorporate the type into the name make it the last word 不要使用 ACTIONSCRIPT 1 的类型连接后缀如 mc 表明类型 例如 命名一个 border shape 可以是 border borderSkin 或 borderShape 但不是 border mc var button Button new Button 包名包名 Eric Huang s Creative Studio 实现了许多相似东西的包的包名要采用该类事物的复数形式 charts collections containers controls effects events formatters managers preloaders resources skins states styles utils validators 对于实现了某种概念的包一般用动名词的形式 binding logging messaging printing 否则 它们通常只是 概念名词 accessibility core graphics rpc 一个包含支持 FooBar 组件的类应当命名为fooBarClasses 文件名文件名 对于含一个大写字母的元数据 Style 包含文件的文件名 后续单词采用首字母大写且将最后单词 写为 sytles BorderStyles as ModalTransparencyStyles as 以全部小写字母并且下划线进行单词连接的形式来命名个人资产文件 icon align left png 命名空间名命名空间名 已全部小写字母并且消化腺进行单词连接的形式命名 mx internal object proxy 接口名接口名 以 I 开头并且后续单词使用首字母大写的形式 IList IFocusManager IUID 类名类名 大写字母开头后续单词首字母大写 Button FocusManager UIComponent Event子类命名 FooBarEvent Error子类命名FooBarError Name the EffectInstance subclass associated with effect FooBar FooBarInstance Eric Huang s Creative Studio Formatter子类命名FooBarFormatter Validator子类命名FooBarValidator 外观类命名 FooBarBackground FooBarBorder FooBarSkin FooBarIcon FooBarIndicator FooBarSeparator FooBarCursor等 工具类命名 FooBarUtil 不是 FooBarUtils 包名复数但类名要用单数 常用基类命名方式 FooBarBase ComboBase DateBase DataGridBase ListBase 事件名事件名 小写字母开头并且后续单词首字母大写 move creationComplete 样式名样式名 小写字母开头并且后续单词首字母大写 color fontSize 字符串属性枚举值字符串属性枚举值 小写字母开头并且后续单词首字母大写 auto filesOnly 常量名常量名 全部大写且单词采用下划线连接 OFF DEFAULT WIDTH public static const FOO BAR String fooBar 属性属性 变量和变量和 getter setter 名名 小写字母开头并且后续单词首字母大写 i width numChildren 使用i作为 for 循环的外层循环索引值 n 作为其上限值 使用j作为 for 循环的内层循环索引值 m 作为其 上限值 Eric Huang s Creative Studio for var i int 0 i n i for var j int 0 j m j 使用 p 表示 property 作为for in 循环变量 for var p String in o mx internal final function get numChildren int return super numChildren 存储变量名存储变量名 替 getter setter foo 命名一个存储变量名 foo 方法名方法名 小写字母开头并且后续单词首字母大写 measure updateDisplayList 不带参数的方法不应当采取getFooBar 或 setFooBar 命名形式 而应设计成 getter setter 不 过 如果getFooBar 是一个需要大量计算的缓慢方法 应当将其命名为findFooBar calculateFooBar determineFooBar 等 而不是一个 getter mx internal final function addChild child DisplayObject DisplayObject return super addChild child 事件处理方法名事件处理方法名 事件处理程序名应当在事件类型后面连接一个 Handler mouseDownHandler Eric Huang s Creative Studio 如果处理程序是服务于派发给子控件的事件 i e not this 在处理程序名前面加一个子控件名前缀然后以 下划线后处理程序名组合 textInput focusInHandler 参数名参数名 对任何 setter 的参数使用value 作为参数名 这样做 public function set label value String void 而不是 public function set label lab String void 或者这样做 public function set label labelValue String void 或者这样做 public function set label val String void 使用 event 而非 e evt or eventObj 作为每个事件处理程序的参数 protected function mouseDownHandler event Event void 资源包名资源包名 如果一个资源包名包含特定包的资源 应该以相同的名字命名这个资源包 controls formatters validators 资源键名资源键名 小写字母开头且后续单词首字母大写 pm dayNamesShort 杂项名杂项名 语言使用语言使用 编译选项编译选项 Eric Huang s Creative Studio 采用 strict and show actionscript warnings 编译选项进行编译 在 flex config xml 文件中会有一些缺省值 基于属性的基于属性的 APIs 类型定义类型定义 这样做 var value 而不是这样 var value 使用合适的最紧致的类型 例如 循环变量索引应当是 int 型 不是 Number 型 当然更不会是 Object 或 另一个例子 mouseDownHandler应当声明一个参数 event MouseEvent 而不是 event Event 整型数使用int 即使它不是负数 使用uint作为 RGB 颜色值 位掩码和其他非数字值 使用 仅在该值没有定义的情况下 你应当通常使用 Object 而不是 You should generally use Object rather than 具有 null 代表 对象不存在 值 这样做 var a Array of String 而不是这样 var a Array 这样做 function f a Array of Number Array of Object 而不是这样 function f a Array Array Eric Huang s Creative Studio 文本文本 undefinedundefined 避免使用如果可能的话 仅仅是在编译时变量的类型是 It is only necessary when dealing with values whose compile time is type is and you should be using sparingly as well intint uintuint 这样做 2 而不是这样 2 十六进制数使用一个小写字母x和大写字母 A Z 这样做 0 xFEDCBA 而不是这样 0Xfedcba 这样做 private const BLACK uint 0 x000000 而不是这样 private const BLACK uint 0 NumberNumber 这样做 alphaFrom 0 0 alphaTo 1 0 而不是这样 alphaFrom 0 alphaTo 1 这样做 Eric Huang s Creative Studio var xOffset Number 3 而不是这样 var xOffset Number 3 0 指数表示法表示数字时使用 e 而不是 E 这样做 1 0e12 而不是这样 1 0E12 使用值NaN 作为非Number类型的缺省值值 StringString 这样做 What s up Big Boy 而不是这样 What s up Big Boy 使用 u not U 作为 Unicode 转义字符序列 ArrayArray 使用数组文本而非new Array 这样做 而不是这样 new Array 这样 1 2 3 Eric Huang s Creative Studio 而不是 new Array 1 2 3 使用 Array 构造函数仅仅是作为预留数组大小时 比如new Array 3 意为 undefined undefined undefined not 3 ObjectObject 使用 Object 文本而非new Object 这样做s 而不是这样 new Object 这样做 o a 1 b 2 c 3 而不是这样 o new Object o a 1 o b 2 o c 3 或这样 o o a 1 o b 2 o c 3 FunctionFunction 这样做s function i int void doIt i 1 doIt i 1 而不是这样 Eric Huang s Creative Studio function i int doIt i 1 doIt i 1 RegExpRegExp 这样做 var pattern RegExp d g 而不是这样 var pattern RegExp new RegExp d g XMLXML and XMLListXMLList 这样 var node XML 而不是这样 var node XML new XML 这样做 var node XML 而不是这样 var node XML ClassClass 这样做 import mx controls Button var b Button new Button 而不是这样 import mx controls Button var b Button new mx controls Button 但下面这种情况下使用全限定名才是合适的 import mx controls Button import my controls Button Eric Huang s Creative Studio var b Button new mx controls Button 表达式表达式 括号括号 这样做 var e Number a b c d 而不是这样 var e Number a b c d 这样做 var e Boolean a 而不是这样 var e Boolean a 强制转换强制转换 这样做 if flag 而不是这样 if flag true 这样做 var flag Boolean a 而不是这样 var flag Boolean a 类型类型你能记起一下哪个是强制转换失败时的值吗你能记起一下哪个是强制转换失败时的值吗 Number0 NaN Stringnull XML XMLListnull Arraynull Eric Huang s Creative Studio Objectnull 0 NaN false undefined null 0 NaN false 这样做 if s null i n i 而不是这样 for var i int 0 i n i 条件运算符条件运算符 这样做 return item item label null 而不是这样 if item return null return item label 这样做 if a b return 1 return 0 而不是这样 return a b 1 0 newnew 运算符运算符 这样做 var b Button new Button 而不是这样 var b Button new Button 语句语句 这样做 a 1 b 2 c 3 Eric Huang s Creative Studio 而不是这样 a 1 b 2 c 3 includeinclude语句语句 使用 include 而不是 include 也像其他语句一样后面加个分号结束 这样做 include core ComponentVersion as 而不是这样做 include core ComponentVersion as ImportImport语句语句 这样做 import mx controls Button import flash utils getTimer 而不是这样 import mx core useuse namespacenamespace语句语句 这样做 import mx core mx internal Later in some method mx internal doSomething 而不是这样 import mx core mx internal use namespace mx internal Later in some method doSomething Eric Huang s Creative Studio ifif 语句语句 这样做 if flag doThing1 而不是这样 if flag doThing1 这样做 if flag doThing1 else doThing2 而不是这样 if flag doThing1 else doThing2 这样做 if flag doThing1 else doThing2 Eric Huang s Creative Studio doThing3 而不是这样 if flag doThing1 else doThing2 doThing3 这样做 if condition1 return false if condition2 return false if condition2 return false return true 而不是这样 if condition1 if condition2 if condition3 return true Eric Huang s Creative Studio return false forfor 语句语句 这样做 for var i int 0 i 3 i doSomething i 而不是这样 for var i int 0 i 3 i doSomething i 这样做 var n int a length for var i int 0 i n i 而不是这样 for var i int 0 i a length i 这样做 for var i int 0 i 3 i 而不是这样 var i int for i 0 i 3 i Eric Huang s Creative Studio whilewhile 语句语句 这样做 while i n doSomething i 而不是这样 while i n doSomething i dodo 语句语句 这样做 do doSomething i while i n 而不是这样 do doSomething i while i n switchswitch 语句语句 这样做 switch n case 0 foo break Eric Huang s Creative Studio case 1 bar return case 2 baz return default blech break 而不是这样 switch n case 0 foo break case 1 bar break case 2 baz return break Eric Huang s Creative Studio default blech returnreturn 语句语句 这样做 return n 1 而不是这样做 return n 1 声明声明 这样做 var a int 1 var b int 2 而不是这样 var a int 1 b int 2 overrideoverride关键字关键字 如果存在重载的情况 请将这个关键字放在第一位 在访问限定符前面 这样做 override protected method measure void 而不是这样 protected override method measure void 访问限定符访问限定符 StaticStatic关键字关键字 这样做 public static const MOVE String move 而不是这样 static public const MOVE String move Eric Huang s Creative Studio finalfinal关键字关键字 这样做 public final class BoxDirection 而不是这样 final public class BoxDirection 将所有 枚举类 声明为 final 型的 也常常将 基本 属性和方法 以 开头 为 final 类型 常量常量 这样做 public static const ALL String all 而不是这样 public const ALL String all 变量变量 这样做 private var counter int 1 而不是这样做 private var counter int public function MyClass super counter 1 局部变量局部变量 内部变量在使用的时候才进行声明 而不要都放在函数开始时 这样做 private function f i int j int int Eric Huang s Creative Studio var a int g i 1 g i 1 var b int g a 1 g a 1 var c int g b 1 g b 1 return a b c a b c 而不是这样做 private function f i int j int int var a int var b int var c int a g i 1 g i 1 b g a 1 g a 1 c g b 1 g b 1 return a b c a b c Declare local variables only one per function ActionScript 3 doesn t have block scoped locals Do this var a int if flag a 1 else a 2 Eric Huang s Creative Studio Not this if flag var a int 1 else var a int 2 And this var i int for i 0 i n i for i 0 i n i Not this for var i int 0 i n i for var i int 0 i n i 类类 Eric Huang s Creative Studio The only bare statements in a class should be calls to static class initialization methods such as loadResources 构造函数构造函数 如果构造函数参数对应于实例变量 参数名可以使用与实例名同样的名字 这样做 public function MyClass foo int bar int this foo foo this bar bar 而不是这样做 public function MyClass fooVal int barVal int foo fooVal bar barVal 接口接口 TBD 命名空间命名空间 TBD 实现属性实现属性 TBD 元数据元数据 TBD 包包 文件组织文件组织 版权声明版权声明 Eric Huang s Creative Studio ADOBE SYSTEMS INCORPORATED Copyright 2008 Adobe Systems Incorporated All Rights Reserved NOTICE Adobe permits you to use modify and distribute this file in accordance with the terms of the license agreement accompanying it 注意每一行最多包含 80 个字符 包语句包语句 TBD 导入语句导入语句 TBD 使用命名空间语句使用命名空间语句 TBD Class 元数据元数据 Events ASDoc comment Event ASDoc comment Eric Huang s Creative Studio Event Styles ASDoc comment Style ASDoc comment Style Effects ASDoc comment Effect ASDoc comment Effect Excluded APIs Exclude name horizontalAlign kind style Eric Huang s Creative Studio Exclude name verticalAlign kind style Other metadata DefaultBindingProperty source text destination text IconFile Text png Class 声明声明 TBD Version as include 语句语句 每个类应当使用相对路径包含 core Version as 这个文件包含static const VERSION String 声 明 include core Version as 实现注释实现注释 TBD 类初始化类初始化 TBD 类常量类常量 类最小化类最小化 类资源类资源 TBD 类变量类变量 TBD 类属性类属性 类方法类方法 放置静态方法声明 构造函数构造函数 Eric Huang s Creative Studio TBD 变量变量 TBD 重载属性重载属性 Put overrides of non static getters and setters here Order them alphabetically by property name Use a minor separator with the property name for each one Put the getter before the setter 属性属性 Put new non static getters and setters here Order them alphabetically by property name Use a minor separator with the property name for each one Put the getter before the setter 重载方法重载方法 Put overrides of non static functions here 方法方法 Put new non static functions here 重载事件处理函数重载事件处理函数 Put overrides of event handlers here 事件处理函数函数事件处理函数函数 Put new event handlers here 包外帮助类包外帮助类 TBD 格式化格式化 This section covers how a Flex framework class should be formatted 行宽度行宽度 Wrap code to 80 character lines This has the following advantages Developers with smaller screens don t have to scroll horizontally to read long lines A comparison utility can display two versions of a file side by side The font size can be increased for projection before a group without requiring scrolling Eric Huang s Creative Studio The source code can be printed without clipping or wrapping 缩进缩进 Use 4 space indentation Configure your text editor to insert spaces rather than tabs This allows another program that uses a different indentation setting such as Notepad with its 8 character indents to display the code without disfiguring it Section separators The major section separators inside a class look like this Overridden methods They extend from column 4 through column 80 The text is indented to column 8 The minor section separators inside a class such as between properties look like this visible They extend from column 4 through column 40 The text is indented to column 8 Put a single blank line above and below the separators Separation of declarations Use a single blank line as a vertical separator between constant variable or function declarations private Holds something var a Number Eric Huang s Creative Studio private var b Number Metadata TBD Do this Inspectable a 1 b 2 Not this Inspectable a 1 b 2 Array indexing Don t put any spaces before or after the left bracket or before the right bracket Do this a 0 Not this a 0 Commas Follow a comma with a single space This applies to argument lists array literals and object lite
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025西藏拉萨市属国有企业领导人员公开招聘7人笔试历年参考题库附带答案详解
- 2025荆门市属国有企业应届毕业生专场招聘41人笔试历年参考题库附带答案详解
- 2025秋季浙江金华市义乌市水务建设有限公司招聘39人笔试历年参考题库附带答案详解
- 机关作风纪律整顿工作总结
- 新人教版七年级地理上册期末测试卷及答案【新人教版】
- CN115867453B 显示控制装置和显示控制方法 (三菱电机株式会社)
- 幼儿园公开课教案模板
- 教育信息化应用X案例论文
- CN115837861B Bms休眠唤醒电路、方法、bms和用电设备 (宁德时代新能源科技股份有限公司)
- 课次4教学设计高中日语人教版初级第三册-人教版
- 河道综合治理项目建议书
- 2026日照市医疗面试题及答案
- 《新能源装备装配与调试》课件-项目一任务3光伏电站常用运维仪器仪表及器具的使用
- 2026年河北省中考历史真题
- 2026年广东省公需课《人工智能赋能高质量发展》试题及答案
- 2025-2026学年周三多管理学教学设计
- 金融行业网络安全培训
- 装饰装修工程拟投入的主要施工机械设备表
- 四百字作文格子稿纸(可打印编辑)
- 颅内动脉瘤的护理课件
- 2023年衡阳市蒸湘区体育教师招聘笔试模拟试题及答案
评论
0/150
提交评论