Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Things I learned taking a team into NodeJS

Joseph Heck
December 10, 2014

Things I learned taking a team into NodeJS

NodeJS retrospective on building a product entirely in NodeJS, and getting it running into customer's hands

Joseph Heck

December 10, 2014
Tweet

More Decks by Joseph Heck

Other Decks in Technology

Transcript

  1. Things I learned taking a
    team into NodeJS

    View full-size slide

  2. @heckj
    Joe Heck
    Cofounder and VP of Engineering at Renasar
    Technologies
    Prior worlds:
    • Python
    • Java
    • Objective-C

    View full-size slide

  3. Renasar
    Started Python, C#
    We knew it, was fast
    Web-service with different focus - started into Angular,
    hosting on Heroku
    Wow, we really get stuff done fast!
    Changed product direction in May, moved to NodeJS

    View full-size slide

  4. Dipping a toe
    Yeah, weekend project turned all out effort
    Full transfer for major code in June (mostly from C#)
    No deep team experience in NodeJS, just moved
    quickly
    What we are building is very asynchronous network
    oriented

    View full-size slide

  5. Learning in Anger
    Tools that teach us
    JSHint
    Webstorm IDE
    Load of VIM plugins
    Jenkins driving EVERYTHING, have it yell at us

    View full-size slide

  6. The Obvious Things
    Prototype inheritance
    Javascript, The Good Parts
    Where’s my damn list comprehensions!?!?
    Thank god for underscore, lodash
    Dynamic language vs. static compiled languages
    testing as a priority, assert-plus
    Functional scope vs. Object scope

    View full-size slide

  7. The Subtle Things
    All the calls are asynchronous.
    No, Really!
    Nested callback hell to guarantee sequencing
    Promises!
    there’s SO many to choose from - we use Q
    Hierarchical module imports in NodeJS

    View full-size slide

  8. rewrite lots of constructors to pass in more and more
    things
    configuration, logging, etc…
    Finally - di.js
    What’s the scope for that function?
    Rewriting to be able to test functions otherwise
    hidden via scoping

    View full-size slide

  9. NodeJS is young…
    Caveat Emptor on libraries!
    Greater variability than I expected from other
    languages
    Don’t like that way of doing it? That’s ok, probably have
    of JS developers don’t either and made another way of
    doing it
    Node.js, IO.js

    View full-size slide

  10. ES6
    NodeJS on the server, browser implementation
    pieces - all sorts of convoluted
    Transpilers and build tools galore
    Make, Grunt, and Gulp
    Yoeman

    View full-size slide

  11. WTFBBQ?!?!
    DHCP server - listens on raw socket for broadcasts
    NodeJS doesn’t appear to support the full raw
    socket API - can’t bind to a specific interface, end up
    having to bind to 0.0.0.0 to get it to work
    Corner case for most, but surprised the hell out of us!
    To-do on our list to patch or expose and submit
    upstream

    View full-size slide

  12. Libraries
    Machina, postal, Q, nconf, lru-cache
    And more commonly known ones:
    lodash
    express
    request
    mongoose
    commander

    View full-size slide

  13. Testing
    Started with Jasmine, switched to Mocha
    Chai, Sinon, chai-as-promised, sinon-as-promised
    Mockery, istanbul
    JSDoc, APIdoc
    memwatch, strongloop, statsd

    View full-size slide

  14. Refinement
    Mongoose -> Waterline
    Validation and CRUD lifecycle
    migrations, adapters to different backends
    API management
    Swagger: JSON-Schema ++ for APIs
    Multi-language library support

    View full-size slide

  15. Releasing
    NPM is great, but multi-repo can be a pain
    Debian and RPM packaging
    dependency management in packages is ugly
    Deploying updates
    Linux OS conventions for hosting NodeJS

    View full-size slide

  16. 6 months, code in the wild
    Damn, we get a lot of stuff done quickly!
    Asynchronous has been beautiful, if occasionally
    painful
    Reaping the scaling, multi-protocol benefits
    Q/Promises making a huge difference
    Peer review and tools to suggest critical issues

    View full-size slide

  17. Q&A
    HIRING!
    @heckj
    github.com/heckj
    [email protected]

    View full-size slide