1. Name Conventions 命名规范

     1) Classes 类
         a. 类名只能包含数字字母 only contain alphanumeric characters
         b. 允许但不鼓励使用数字  numbers are permitted but discouraged
         c. 不能使用下划线、减号或其他特殊字符
         d. 类要按包名组织,至少需要一个最顶层的唯一包名
         e. 最顶层的包名和类名应该大小写,其他中间名字需小写 top-level namespaces and the actual class names should be CamelCased
         f.  缩略词也应该遵循大小写原则
         g. 非Sencha发布的类不允许使用Ext作为最顶层的包名
 
     2) Source Files  源文件
         a. 类名直接映射成文件路径 names of classes map directly to the file paths
         b. 一个类一个文件
         c. Ext.util.Observable => /path/to/src/Ext/util/Observable.js
 
     3) Methods and Variables 方法与变量
         a. 方法与变量名只能包含数字字母 only contain alphanumeric characters
         b. 允许但不鼓励使用数字  numbers are permitted but discouraged
         c. 不能使用下划线、减号或其他特殊字符
 
     4) Properties 属性
         a. 属性的命名规范与变量的命名规范类似
         b. 静态属性的名称必须全部大写
 
 
2. Declaration 声明
     1) The Old Way
         a. var MyClass = Ext.extend(object, {...});
         b. Ext.ns("My.cool");  My.cool.Window = Ext.extend(Ext.Window, {...});
 
     2) The New Way
         a. Ext.define(className, members, onClassCreated);
         b. Ext.create(className, arguments);
 
3. Configuration 配置
     1) As for EXTJS 4, a dedicated config property was introduced
     2) Configurations are completely encapsulated from other class members
     3) Getter and setter methods for every config property are automatically generated into the class prototype during class creation if methods are not already defined
     4) The auto-generated setter method calls the applyXXX method (if defined on the class) internally before setting the value. You may override the applyXXX method for a config property if you need to run custom logic before setting the value. If your apply method does not return a value, the setter will not set the value. The updateXXX method (if defined) will also be called when a different value is set. Both the applyXXX and updateXXX methods are passed the new value and the old value as params.
     5) As for EXTJS 5, eliminated the need to call initConfig() manually. Only for your own classes that extend Ext.Base, initConfig() still neneds to be called
 
4. Statics 静态成员
     1) 通过配置statics来定义静态成员 static members can ben defined using the statics config
     2) Ext.define('Computer', {
              statics: {
                    instanceCount: 0,
                    factory: function(brand) {
                         return new this({brand: brand});
                    }
               },
               
               config: {
                    brand: null
               }
         });
         var dell = Computer.factory('dell');
 
5. Errors Handling & Debugging 错误处理及调试
     1) 通过Ext.getDisplayName()获取方法的名称。尤其是在需要抛出异常
          throw new Error('['+ Ext.getDisplayName(arguments.callee) +'] something wrong ');
     2) 使用Ext.define()定义的任意类方法在抛出异常时,可以在WebKit浏览器上观察到异常栈(Chrome/Safari)

EXTJS 5 学习笔记1 - Class System的更多相关文章

  1. Java学习笔记25(System类)

    System类,系统类,包含的是静态方法,无法创建对象 这里介绍几个简单的方法,其他一些在后边用到的时候会讲 类方法: currentTimeMillis():获取当前毫秒数 package demo ...

  2. EXTJS 5 学习笔记2 - Components

    1. The Components Hierachy 组件体系       2. XTypes and Lazy Instantiation xtype与延迟初始化        1) 每个compo ...

  3. APUE学习笔记——10.18 system函数 与waitpid

    system函数 system函数用方便在一个进程中执行命令行(一行shell命令). 用法如下: #include <stdio.h> #include <stdlib.h> ...

  4. Java基础学习笔记之:System类;Math类;Arrays类BigInteger,BigDecimal

    System类 在API中System类介绍的比较简单,我们给出定义,System中代表程序所在系统,提供了对应的一些系统属性信息,和系统操作.System类不能手动创建对象,因为构造方法被priva ...

  5. Extjs Cmd 学习笔记

    1.sencha app build 命令 <!-- <x-compile> -->                  <!-- <x-bootstrap> ...

  6. 【WPF学习笔记】之 System.Exception 对象名 'XXXX' 无效。

    我在运行vs时候发现项目报错,如下图: 报Exception错误,对象名“XXXXXX”无效. 经过调查得知,因为连接数据库的库名写错了,如下: 对应正确数据库的库名: 把库名改正确,问题就解决了.

  7. A.Kaw矩阵代数初步学习笔记 5. System of Equations

    “矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...

  8. Extjs 学习笔记1

    学习笔记 目   录 1 ExtJs 4 1.1 常见错误处理 4 1.1.1 多个js文件中有相同的控件,切换时无法正常显示 4 1.1.2 Store的使用方法 4 1.1.3 gridPanel ...

  9. system generator学习笔记【02】

    作者:桂. 时间:2018-05-20  23:28:04 链接:https://www.cnblogs.com/xingshansi/p/9059668.html 前言 继续学习sysgen.接触s ...

随机推荐

  1. 添加sqljdbc4的maven依赖

    sqljdbc是微软sql server的jdbc驱动 使用sqljdbc需要从微软的官方网站下载jar包: http://www.microsoft.com/en-us/download/detai ...

  2. js中replace的用法

    replace方法的语法是:stringObj.replace(rgExp, replaceText) 其中stringObj是字符串(string),reExp可以是正则表达式对象(RegExp)也 ...

  3. C#中Serializable序列化

    序列化就是是将对象转换为容易传输的格式的过程,一般情况下转化打流文件,放入内存或者IO文件 中.例如,可以序列化一个对象,然后使用 HTTP 通过 Internet 在客户端和服务器之间传输该对象,或 ...

  4. Linux系统多网卡绑定实战

    导读 对于服务器来说,网络设备的稳定也是比较重要的,特别是网卡.在生产型的系统中,网卡的可靠性就更为重要了. 多块网卡绑定到一个IP地址,当一块网卡发生物理性损坏的情况下,另一块网卡自动启用,并提供正 ...

  5. 【Nodejs】nimble或async并不能保证程序串行执行,回调是回避不了的坑

    先看一段例程: //------------------------------- // 用于创建目录 //------------------------------- function creat ...

  6. 【Node.js】初体验之安装和HelloWorld

    听说Node.js是个蛮吊的东东.中午休息时间有限,暂时看了下知道怎么安装和初步使用了. 1.安装: 到Node.js官网下载就可以了,才5M多点,双击后按步骤安装就可以了. 2."Hell ...

  7. Highstock生成股票K线图

    在线演示 本地下载 使用HightStock生成股票K线图例子.

  8. C#.NET常见问题(FAQ)-找不到类型或命名空间名称“ManagementBaseObject”怎么办

    如下图所示,虽然添加了using System.Management,还是报错   System.Management似乎跟普通的命名空间不太一样,这个项目还需要添加.右击这个项目的csproj文件, ...

  9. PyQt5教程——第一个程序(2)

    用PyQt5写的第一个程序 在这篇PyQt5教程中,我们可以学习一些PyQt5的基础应用. 简单的例子 这是一个显示一个小窗口的简单例子.我们可以做许多这样的窗口.我们可以调整它的窗口尺寸,最大化或最 ...

  10. 亲自己主动手从源代码 构建 Groovy 2.3.8 公布包

    今天为了学习 怎样使用 Groovy 写 Groovy 的測试代码, 所以到 http://groovy.codehaus.org/Download 下载了 Groovy 2.3.8 的源码包. Gr ...