Skip to content

Coding Style Conventions

bluong edited this page Nov 21, 2014 · 11 revisions

Placing a wiki here to document the code style conventions that we have agreed upon moving forward.

Interface placement

  • Interfaces should be placed at the top of a module, preferably in alpha order in case of collisions.

Returning Arrays

  • Getters that return arrays currently just return the array directly, rather than a shallow copy (from slice()). We think this way of doing things is easier to reason about, but it might be worth changing later on.

Exposed vs Not-exposed Member Naming

  • Members / Functions that are publicly exposed to the user (essentially anything with a public modifier) should not start with an underscore "", whereas members/functions that are not publicly exposed should start with an underscore "". This is to make more clear to a Javascript consumer that underscored members should not be touched and if they are, it's an error on their or our end.