Thinking in programming

Things I like to talk about programming

Flex Coding Conventions

with 3 comments

This document is intended to set the coding
conventions for the Flex side.

General Requirements

Only the most recent release of Adobe Flex
should be used. Currently the release is “Flex 3”.

Standard object oriented programming principles
must be used in the Flex code development.

A concept for error handling should be provided
and used by the Flex developers.

A concept for security should be provided and

Necessary Development Concepts

The following is a list of necessary concepts for Flex application development:

  • Error handling and reporting.
  • Application security and authentication.
  • Client side input validation. In certain modules, it may be necessary to create concepts for L10N and I18N.


All package names should be meaningful and
should be prefixed with com.companyname. For example, org.rogerpadilla

When importing packages into classes, it is
preferred to import concrete classes instead of entire packages.


All files must be encoded in the UTF8

  • MXML file names: UpperCamelCase.mxml
  • ActionScript file names: for classes and all interfaces should be prefixed with I (

Classes, functions and code

The following is the set of coding rules
for ActionScript:

  • There should not be magic numbers, strings or values present in the code. Easily accessible constants, property files, xml files should be created where all such values will be kept. For example, a remote service URL should not be hardcoded.
  • Each class, function and class property should be commented. Non-obvious blocks of code should be preceded with a commented explanation of what they do.
  • Multiple variables should not be declared in a single line.
  • Multiple statements should not be placed on a single line.

The following is the set of coding rules
for MXML:

  • Use external style files.
  • There should be only one script block per MXML file, and it should follow the same guidelines as usual ActionScript files, because it should be exportable with asdoc.


All MXML files should contain a brief
desctiption if what they do and where they are used.

All ActionScript classes, functions and
class attributes should be commented with meaningful information in English. It
should be easy to create a documentation export using Flex’s asdoc tool,
where all packages, classes and functions can be reviewed.

For functions, there should be at minimum a
@param tag for each parameter, @return tag for returned
values, and a description of what the function does.


Written by roger.padilla

March 31, 2009 at 10:28

Posted in Coding Conventions

Tagged with ,

3 Responses

Subscribe to comments with RSS.

  1. Uh, I don’t agree with a few things….

    Interfaces should NOT start with I. Implementations should end with Impl.
    i.e. (interface) (implementation).
    This lends itself to better design by coding to interfaces.

    Also, not everything should be ASDoc’ed. Adding comments to code that is already clear is wasteful.

    For a much better resource than me, or this blog post, do yourself a favor and buy the book “Clean Code” by Robert C. Martin. it’s on safari, and can also be purchased from amazon.

    Jonathan Doklovic

    April 1, 2009 at 08:27

  2. nice, really nice!


    April 17, 2009 at 01:09

  3. to GoogleReader!
    Thank you


    April 23, 2009 at 10:17

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: