开发者

ExtJS 4 Naming Conventions

I开发者_如何学编程 was discussing with my colleagues the correct naming conventions for classes, variables and objects etc within ExtJS 4, but we all had differing views.

Is there an "official" stance on this?


There absolutely is an official stance. It is outline in section 2 of the Class System guide. Here is the link: https://docs.sencha.com/extjs/7.2.0/guides/core_concepts/classes.html#core_concepts--classes-_naming_conventions


Official, I'm not sure, but in my opinion..

  • Root namespaces and constructors are UpperCamelCase
  • Sub-namespaces, styles, events and xtypes are lowercase
  • Methods, attributes and variables are lowerCamelCase


I recently attended an Ext.js 4 training course (delivered by Sencha) and their advice was the following:

  • Top-level namespaces and the actual class names should be Camel Cased. everything else should be in lowercase.
  • Acronyms should also be camel cased
  • Do not use underscores, hyphens an any other non-alphanumerical characters

So Hugh is pretty much on the money


It's preference, really. What Hugh said are good guidelines, but I actually prefer namespaces to be in ALL CAPS, but our apps have fairly short namespaces so it doesn't look ridiculous.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜