Skip to content
Charles Ofria edited this page Jan 24, 2015 · 4 revisions

These need to be better organized, but some basic guidelines are:

  • All code should be in header files for ease of inclusion into Emscripten projects.

  • Files that define a single class should be named after that class. Files that define sets of functions or multiple classes should have an all-lowercase name that describes its contents.

  • All files and all directories must be levelized. This is partly enforced through all files being headerfiles (and thus we cannot have circular dependencies), but for clean coding practices (and easy of unit testing) whole directories should not refer to each other bidirectionally either. See Large-Scale C++ Software Design by John Lakos for a strong pro-levelization argument.

  • In-code identifier formatting is always hard to settle upon. The guidelines below are for consistency.

    • Variable names should be all_lowercase, with words separated by underscores
    • Member functions should be CamelCase
    • Regular functions can be all_lowercase if meant to by standard tool functions, to fit in with C++ built-in libraries.
    • User-defined types should be CamelCase
    • Constants should be ALL_UPPERCASE, with words separated by underscores
    • Templated types should be ALL_UPPERCASE.
    • Typedefs should match the casing of the types they are aliasing. For example, a typedef on a template parameter might be all uppercase, while a typedef on a user-defined type should be CamelCase.
Clone this wiki locally