Google Coding Conventions
Only deviations from the Google style guide will be documented here.
We JsDoc comments as outlined in the Google style guide with but we name the variable name directly after the @param tag and the type without curly braces.
Generally we encourage inline comments. These help readers of your code to understand the logic without having to understand every line of code. It's also a good practice to write inline comments before you write code so that you first think about the logic and semantics you want to implement and then about the syntax.
We do not generally use the @protected and @private markers that Google recommends. We do, however, implement the following nomenclature for class members (properties and methods):
- We group members by visibility and class (static) vs. object (instance) membership:
- First static then instance members.
- Within those two groups: first public members, then protected members and finally private members.
- Sections are divided with a three line // style comment indicating static vs. instance membership and visibility of class/object members grouped below the comment.
- An underscore at the start of the name marks a class member private. You are not supposed to use such a member outside scope even if the visibility is not enforced by closure.
- Protected class members are named like public methods but they must not be used outside of the inheritance hierarchy of the current class.