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.
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.
This section defines how all elements in your code should be named, as well as some special cases for specific types of classes.
DefinitionsAbbreviations should not be used. Extremely common abbreviations, such as min or max, are okay.
AcronymsAcronyms 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 NamesAll components should have the word 'Component' appended to their name.
Event NamesAll events should have the word 'Event' appended to their name.
Callback Names and Event HandlersThe first word should always be 'on'.
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 MessagesThese should be used to report general information about the state of the engine.
Log WarningsThese should be used to report problems that don't inhibit the engine's ability to run, but could potentially be a problem.
Log ErrorsThese should be used to report problems that could impact the ongoing stability of the engine.
ExceptionsThese should be used in situations that cannot be recovered from.