DownTheRabbitHole.jsHow to Stay Sane in an Insane Ecosystem
Space Forensics Government contract For an educational Lucas Arts style game For NASA!
I feel like Im taking crazy pills.
First, a bit of history.
In the beginning 1995 - Over 10 days Brendan Eich of Netscape made Mocha
Renamed to LiveScript
1997 - ECMAScript v1 (ECMA-262) standard defined
1998 - ECMAScript v2 - now an ISO standard (ISO/IEC 16262)
Power Struggle Plugins for non-trivial interactivity Big fights over ECMAScript v4 End result was v3.1 v5 in
In the meantime
2005 - AJAX white paper
2006 - jQuery, Mootools, Prototype, & Dojo
Make working with the DOM easier
Smooth over cross-platform issues
Bring common patterns to JS (observables, promises, etc)
node.js & npm 2009 - node.js released
Powered by Googles v8 JS engine for Webkit
JS on the server anywhere!
2011 - npm released
Package manager for JS
Which results in
Easy to publish to npm
Quality varies wildly
Lots, and lots of dodos
329,149modules on npm as of 9/22/2016
No language support for modules!
Work arounds it is!
Yeoman, Slush, etc.
Coffeescript, TypeScript, Dart, Babel, Clojurescript, Elm, etc.
Grunt, Gulp, Webpack, Brunch, etc.
On the horizon asm.js
Compile C, C++, Lua, Ruby, Python, etc. to JS
ECMAScript v6 (ES6) - Modules! Tons of new syntax!
WebComponents - emerging standard (Polymer polyfill)
HTTP/2 - everything you know about HTTP is wrong
Rein in the madness
One size does not fit all
What are you building?
How big will the codebase be?
Who is your audience?
What does your team know?
When is the project due?
How long will your code last?
Not just a technical problem!
Affects employee moral
Affects internal training
Need to know JS too
Matters less than discipline
More complex tooling
Just the good parts
ES6 via BabelOur choice:
Invest in great tooling The best setups have the tightest feedback loops
One-click is great, no clicks is better
Automate all the things!
Building (including sourcemaps!)
Document your tools like crazy
webpack (right now) brunch (future projects)
Whats the core idea?
Can they explain it?
What is their inspiration?
Are they solving your problems?
Does it play well with others?
Small vs. Big
Monolithic = consistency
Larger mental load
Bad docs = bad software
Read the docs! (Yes, all of them!)
Read the code! (Yes, all of it!)
Lisp in Cs Clothing
One-way data binding
Our choice (SPAs):
lodash + react + redux
Options from the Big Boys
vue.js - view layer
zepto - jQuery
riot - react
meteor - full stack!
Other great libraries
d3 - data visualization
rxjs - reactive programming
jest - testing made easy
moment - dates & times
superagent - ajax
You cannot stop swimming
Picking a winner is a bad idea
Find what works for you
But never stop searching for better