Saturday, August 10, 2002

Coding Convention for RealityWorks

- File naming convention: need to figure this out
- Avoid using magic number in code (such as frame #, loop ending condition, etc.)
- Array index starts from 0
- Symbol names starts with gfx_, mov_, snd_ to indicate the types.
- Configuration data should either come from a cfc component, an XML file or the database.
- Some code can be factored into functions - such as a function that calculates the position of each clip given the canvas size and the image size.
- All resources are outside of the clients.
- Use var where appropriate
- Change all flash 4 syntax to flash mx syntax (such as /:)
- Use object instead of array where appropriate
instead of:
AreayXY = new Array();
ArrayXY[0] = x;
ArrayXY[1] = y;

function point(x, y)
{
this._x = x;
this._y = y;

this.getX() = function() { return _x; }
this.getY() = function() { return _y; }

this.setX() = function(val) { this._x = val; }
this.setY() = function(val) { this._y = val; }
}

var pt1 = new point(x, y);