Skip to content

vojtesaak/javascript

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Storyous developers bootstrap() {

Table of Contents

  1. Technology
  2. Newbie dictionary
  3. Code style
  4. Git flow
  5. Quick tips

Technology

⬆ back to top

Newbie dictionary

  • 2.1 POS: Point of sale, an Android application for restaurants. They use it to print and track bills.

  • 2.2 PRO: Storyous for PROffesionals. Our sales page. (pro.storyous.com)

  • 2.3 WWW: Social network and magazine for foodies. (storyous.com)

  • 2.4 PAY: Backend for POS system (APIs and web application).

  • 2.5 WIKI: Every project is documented on it's Github wiki.

  • 2.6 JIRA: Our project tracking and bug reporting SW. here.

⬆ back to top

Code style

⬆ back to top

Git flow

  • 4.1 Keep git clean: We use a Gitflow workflow to manage projects on git.

    • Never commit to master/alpha/beta/dev branches directly
    • Each "feature" should have own branch
    • Make a pull request when the work is done

Gitflow

⬆ back to top

Quick tips

  • 5.1 Avoid callback hell. Keep the app clear.

    • Use Promisses and Deferreds to keep an order.
    • But it's not a silver bullet!

We use Q module

```javascript

publicMethod: function (foo, bar, callback) {
    this.doSomethink(foo)
        .then(this._nextMethod(bar))
        .then(callback);
}

```
  • 5.2 Keep the code simple and self descriptive: It's good to keep methods, classes and files short and self descriptive.

    • keep file 500 lines max. (300 is good)
    • keep methods 40 lines max. (25 is good)
    • max. 4-5 arguments in method (use instance of a Class, when u need more)
    • max 3-4 nested blocs (ifs/cycles/functions) in a method
  • 5.3 Keep names when using require:

// bad
var service = require('./someServiceName');
var someClassName = require('./someClassName');
var mongo = require('mongodb');

// good
var someServiceName = require('./someServiceName');
var SomeClassName = require('./someClassName');
var mongodb = require('mongodb');
  • 5.4 JSON does not guarantee property order in object, but MongoDB does:
db.test.update({_id: 'abc'}, {
    $addToSet: {
      field: {
        $each: [ 
          {a: 1, b: 2}, 
          {b: 2, a: 1}  // not the same object !!!
          ]
      }
    }
  });

⬆ back to top

};

About

JavaScript Style Guide

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%