708's Wiki

Dudes of 708's knowledge base for getting started and tools we use

Edit the wiki on GitHub dudesof708/wiki

Visit our homepage dudesof708.com

Dudes of 708 Style Guide


Back to homepagesoftware development


Table of Contents

Please select the relevant programming language below.

C

The official C style guide is coming soon. For now, please contact our engineering manager Gideon Tong <gideon@dudesof708.com> for guidelines on writing C.

Javascript

Our Javascript style guide is adapted from Airbnb’s Internal ES6 Style Guide. Listed below are the most important resources, but for more style guidelines and interpretations, see the Airbnb style guideline link above.

Javascript: Table of Contents

Back to top

Javascript: Types

  1. Keep your references as const and avoid using var, if necessary, use let for scoping.

Back to top (Javascript)

Javascript: Objects

  1. Initialize objects by using literal syntax. Example:

    const item = new Object();
    
  2. Only quote object properties are are invalid identifiers. Example:

    const object = {
        foo: 3,
        bar: 4,
        'data-blah': 5
    };
    
  3. Do not call Object.prototype methods directly, instead use the prototype. Example:

    // do this
    Object.prototype.hasOwnProperty.call(object, key));
    
    // not this
    object.hasOwnProperty(key);
    

Back to top (Javascript)

Javascript: Arrays

  1. Use Array.from instead of Array.map. Example:

    Array.from(foo, bar);
    
  2. Use Array.forEach rather than for loops or another iterable. This prevents mutating the original array. Example:

    array.forEach((item) => {
        // do something cool
    });
    

Back to top (Javascript)

Javascript: Functions

  1. Avoid self-invoking functions. If you choose to use one, wrap one in parenthesis. Example:

    (function() {
        // do something cool
    })());
    
  2. Avoid reassigning parameters.
  3. Use arrow function notation for an anonymous callback. Example:

    const myArray = new Array();
    myArray.forEach((item) => {
        // do something cool
    });
    

Back to top (Javascript)

Javascript: Syntax

  1. Use multiline imports. Example:

    import {
        moduleA,
        module B,
        module C
    } from 'package';
    

Back to top (Javascript)

Python

The official Python style guide is coming soon. For now, please contact our engineering manager Gideon Tong <gideon@dudesof708.com> for guidelines on writing Python.