teenwolf

It’s really hard not to like a show whose main actor is so delightfully dorky.

ceejbot

Seven things you should always do with node.js

ceejbot:

Use the control flow method of your choice

Roll your own with errorbacks, use async to make handling callbacks easier, or move into promises with bluebird: it’s completely up to you. I’ve written code in all three styles this week. Each time I picked the one that felt most appropriate for the problem in front of me.

Use semantic versioning

I sometimes let development dependencies, like the must assertion library, ride free with *. More often I just use npm install --save module-of-awesome, which will save the dep in package.json as ^3.2.1. Periodically I’ll check for out-of-date-ness with npm outdated --depth=0, update, test, and check in a fresher set of version numbers.

Debug with console.log()

For the last 30 years they’ve been telling me that the age of interactive debuggers is here, but for every one of those thirty years I’ve debugged most problems with the humble printf(). It’s fast to implement, reliable, and can be run overnight on complex production systems to catch rare incidents. You should be logging a lot anyway to help with forensic analysis of surprising incidents.

Use REST when appropriate

Not that people these days seem to have trouble with this one; I see RESTful APIs more often than not. I only get cheesed off when somebody bills an RPC API as ‘REST’. RPC is fine too, though it’s out of fashion right now.

Stop caring whether people use semicolons or not

I use them, because I like being explicit and all C-ish when I write JS. I don’t care if you use them, though. I feel you should write your Javascript however you like it best.

Use comma-first if you like it

I don’t do it, but hey, I get why other people do! I solve that problem this way:

var
    _    = require('lodash'),
    P    = require('bluebird'),
    util = require('util')
    ;

But I can totally see how comma-first solves the same problem. Also I am aware nobody else in the world formats the way I do. Which, by the way, doesn’t bug me. I’m okay with being different from you. I can read your code just fine when I need to, and I presume you can read mine too.

Change all your own rules periodically

Set your tab stops to some new & exciting value! Switch indenting styles! Find out what Hungarian notation is good for!1 Change your font! Change your editor’s color scheme! Try a new editor! Try promises! Try going without dependencies altogether!

Stop caring what other people do. It’s all good.


  1. I lied. I’ll totally judge you if you use Hungarian notation.