Programming Guidelines

Naming Conventions

Table and columns use underscores to separate words.

Element names are in lower case, with words separated by underscores. Note that element names become variable names in JSON.

GAIA function and variables names should be in lower case, with words separated by underscores. Exceptions can be made for well known abbreviations (e.g., to_XML()).

As for PHP. JSON variable names are derived from the XML element names.

  • HTML files use .html as the file extension.
  • PHP files use .php as the file extension, and should processed using PHP v5.
  • JavaScript files use .js as the file extension.
  • CSS files use .css as the file extension.


JavaScript has a number of "gotchas" for the unwary

No block mode

JavaScript has no block mode! Variables are either global scope or local to the enclosing function. If a JavaScript file needs initialisation then create an initialisation function and call it to initialise. Otherwise loop counters used in the initialisation can easily clash with other variables. The situation is made worse as it appears in some browsers (FireFox for example) may run initialisation from two included scripts at the same time.

Copying objects creates references

The creation of references is often helpful, but in some cases you may need to make a deep copy of an object or array.
Topic revision: r4 - 2007-03-31 - 02:16:01 - SteveMarple
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback