动作3包命名约定 [英] actionscript 3 package naming conventions

查看:130
本文介绍了动作3包命名约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是包的命名约定与包含多个字的名字? 可以说,我有一个名为花园软管'包,我应该将其命名为garden_hose,gardenHose或者干脆gardenhose?

What are the naming conventions for packages with names that contain more than one word? Lets say I have a package named 'garden hose', should I name it garden_hose, gardenHose or simply gardenhose?

我知道,包通常命名为只有小写字母。我只看到了API做出来的一个词包名,是否有任何约定做出来的几个单词包名?

I know that packages are normally named with lower-case letters only. I only see package names made out of one word in the api, are there any conventions for package names made out of several words?

使用类有:类名。例如赛车,怎么样的包?

With classes we have: ClassName. For instance RaceCar, what about packages?

我有一个包名为animationPath,我想知道我是否应该将其重命名。

I have a package named animationPath and I am wondering if I should rename it.

推荐答案

包名都应该小写。有没有例子在ActionScript 3的文件,因为它们都似乎有一个字的名字,但在另一个ECMAScript的衍生语言,Java的几个包名,揭示了这个约定。例如:

Package names should all be lowercase. there are no examples in the ActionScript 3 documentation, since they all seem to have one-word-name, but several package names in another ECMAScript derived language, Java, reveals this convention. For example:

javax.swing.colorchooser
java.awt.datatransfer

不过,我也看到了驼峰,ALLCAPS,甚至CapitalCase命名的包。虽然我会建议你避免使用全大写,因为这个惯例通常是预留给常量和CapitalCase惯例通常是预留给类名,我相信驼峰包名,如果需要的话,会更宽容。

However, I have also seen packages named in camelCase, ALLCAPS, and even CapitalCase. While i would suggest that you avoid using ALLCAPS, as this convention is typically reserved for constants, and CapitalCase convention is typically reserved for class names, i believe camelCase package names, if desired, would be more forgiving.

这篇关于动作3包命名约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆