Naming conventions
741
Naming packages
It’s common for package names to use “reverse domain” naming convention. Examples of
reverse domain names include
com.macromedia
for macromedia.com, and
org.yourdomain
for yourdomain.org.
Use the following guidelines when you name packages:
■
Put the prefix for a package name in all lowercase letters.
For example,
com
,
mx
, or
org
.
■
Put related classes (classes with related functionality) in the same package.
■
Begin package names with a consistent prefix.
For example, you might use
com.macromedia.projectName
to maintain consistency.
Another example would be
com.macromedia.docs.learnAS2.Users
for the
Learning
ActionScript 2.0
Reference
.
■
Use a clear and self-explanatory package name.
It’s important to explain the package’s responsibilities. For example, you might have a
package named
Pentagons,
which is responsible for using the Flash drawing API to draw
various kinds of pentagons in documentation examples; its name would be
com.macromedia.docs.as2.Pentagons
.
■
Use mixed capitalization for compound or concatenated package names.
packageName
is an example of a compound, concatenated package name. Remember to
use all lowercase letters for the prefix (com, org, and so on).
■
Do not use underscores or dollar sign characters.
Naming interfaces
Starting interface names with an uppercase “I” helps you distinguish an interface from a class.
The following interface name,
IEmployeeRecords
, uses an initial uppercase letter and
concatenated words with mixed case, as follows:
interface IEmployeeRecords{}
The following conventions also apply:
■
Interface names have an uppercase first letter.
This is the same as class names.
■
Interface names are usually adjectives.
Printable
is a good example.
For more information on interfaces, see
Chapter 9, “Interfaces.”
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...