Flex best practices – Part 1: Setting up your Flex project
Working with filenames
Below are several practices you can use to standardize the naming conventions used within your Flex projects.
Use
UpperCamelCasing for MXML file names.
Use
UpperCamelCasing for ActionScript class file names.
Use
UpperCamelCasing for ActionScript interface file names, and begin the file name
with a capitalized letter I.
This indicates that the file is an interface and not a class. Note: this is one practice that has some stigma attached to it. Go with what you find makes sense and then document, communicate, and follow that standard.
Do
not use spaces when naming files!
This can lead to problems all around, and especially on the Mac.
Do
not use special characters when naming files.
Such characters as an exclamation mark "!", right square bracket "[" or left parenthesis "(" can be illegal in many contexts and cause severe issues for your application.
Do
not use acronyms or abbreviations.
An exception to this practice is if the acronym is more commonly used; for example, HTTP, WWW, SQL, and other such acronyms.
Do
not use periods.
Using packages for code organization
Follow the best practices below on using packages for code organization:
Use
packages to organize and structure your projects codebase.
Packages are the standard for OOP-based applications. Packages represent logical groupings of related ActionScript and MXML files in the form of classes. The use of packages and classes is fundamental to object-oriented programming.
To continue with community standards, use the following practices for naming your packages:
Use
lowerCamelCase.
For example: com.seantheflexguy.stringUtils
Begin
the package name with the top-level domain (TLD) of the application's owner:
for example, com, net, us;
then use the application owner's name:
for example: seantheflexguy, adobe;
then the project name:
for example: burrow;
then the logical grouping of related code files:
for example: utils, components, or whatever is appropriate.
Here's an example of a package name using this convention:
com.seantheflexguy.burrow.view
| Attachment | Size |
|---|---|
| adobe_fx_download_button_100x30.jpg | 1.49 KB |
- Login or register to post comments
- 14780 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)











Comments
bet replied on Mon, 2009/06/29 - 2:31pm