Sean is a highly sought after Flex developer and consultant with extensive ActionScript programming experience, including more than five years developing for the Flash platform and over a decade of experience designing and developing desktop and web based applications. Business owner, technical author, blogger and Adobe Flex/AIR enthusiast, Sean is an Adobe Flex Developer Community Champion and the creator of the ActionScript Cheatsheets. Sean has posted 2 posts at DZone. View Full User Profile

Flex best practices – Part 1: Setting up your Flex project

03.11.2009
| 43192 views |
  • submit to reddit

Working with filenames

Below are several practices you can use to standardize the naming conventions used within your Flex projects.

checkmarkUse UpperCamelCasing for MXML file names.

checkmarkUse UpperCamelCasing for ActionScript class file names.

checkmarkUse 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.

checkmarkDo not use spaces when naming files!

This can lead to problems all around, and especially on the Mac.

checkmarkDo 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.

checkmarkDo 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.

checkmarkDo not use periods.

Using packages for code organization

Follow the best practices below on using packages for code organization:

checkmarkUse 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:

checkmarkUse lowerCamelCase.

For example: com.seantheflexguy.stringUtils

checkmarkBegin 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

AttachmentSize
adobe_fx_download_button_100x30.jpg1.49 KB
Published at DZone with permission of its author, Sean Moore.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)