Code Style Guide

The most important thing about a style guide is that it exists and is enforced. Consistency, even to a suboptimal standard, means that it is easy and simple to navigate a code base. Of course, we think this standard makes a lot of sense.

Use The Flex Style Guide

In order to be consistent with most exiting ActionScript codebases, we use the Adobe Flex Coding Conventions. These are the core of our style guide, and the rest of this document merely notes where we differ or expand on their guidelines.

Naming

This section defines how all elements in your code should be named, as well as some special cases for specific types of classes.

Definitions Abbreviations

Abbreviations should not be used. Extremely common abbreviations, such as min or max, are okay.

Acronyms

Acronyms are okay. If the acronym is treated like a word, and the first letter should be capitalized, capitalize every letter in the acronym, otherwise, leave all letters lowercase.

Component Names

All components should have the word 'Component' appended to their name.

Event Names

All events should have the word 'Event' appended to their name.

Callback Names and Event Handlers

The first word should always be 'on'.

Error Reporting

There are several different ways to indicate runtime problems with the execution of the engine. This section defines the situations in which these different methods should be used. Additionally, the errors should be dispatched at the highest possible level in the call stack. For instance, a lookup method should not report that it failed to find an object. Instead, it should return null, and leave the reporting up to the calling method.

Log Messages

These should be used to report general information about the state of the engine.

Log Warnings

These should be used to report problems that don't inhibit the engine's ability to run, but could potentially be a problem.

Log Errors

These should be used to report problems that could impact the ongoing stability of the engine.

Exceptions

These should be used in situations that cannot be recovered from.

Whitespace

Braces

Other

Imports