the future of node - @rvagg - nodeconf christchurch 2015
TRANSCRIPT
1. JavaScript on the server
2. Asynchronous programming
3. Module-driven development
4. Small core, vibrant
ecosystem
5. New models in Open Source
The Essence of Node
So what?
• “Developer joy”
• Productive
• Approachable, sans quirks
• Massive pool of developers
JavaScript on the Server
The Future of Node
• JavaScript is not going away (Dart anyone?)
• Node adoption makes it “the language of the web”
• Helping to drive the future of JavaScript
• Challenges for learning as language complexity
increases
JavaScript on the Server
Eh?
• Alternative programmer mindset
• API focus on callbacks, events and streams
• Limits to Sync()-ability, generally shunned
• Single-threaded!
Asynchronous Programming
System.out.println("Reading file...");
BufferedReader br = new BufferedReader(new FileReader("in.txt"));
try {
StringBuilder sb = new StringBuilder();
String line;
while ((line = br.readLine()) != null)
sb.append(line + "\n");
System.out.print(sb.toString());
} finally {
br.close();
}
System.out.println("Finished reading file!");
So what?
• Scalable:
• Handle huge amounts of I/O with single process
• Single-threaded encourages scalable design
patterns
• Reflective of how the world really works
Asynchronous Programming
The Future of Node
An ongoing battle over programming paradigms
• Promises
• Generator functions for async
• async await (ES7)
The human instinct is to make everything serial!
Asynchronous Programming
Eh?
• npm
• Module system solves most dependency-hell
problems
• Simplicity!
Module-driven Development
So what?
Small chunks of code:
• Focused concerns
• Testable
• Grokkable
• Documentable
• Sharable
• Ease of collaboration
Module-driven Development
module.exports = function archy (obj, prefix, opts) {
if (prefix === undefined) prefix = '';
if (!opts) opts = {};
var chr = function (s) {
var chars = {
'│' : '|',
'└' : '`',
'├' : '+',
'─' : '-',
'┬' : '-'
};
return opts.unicode === false ? chars[s] : s;
};
if (typeof obj === 'string') obj = { label : obj };
var nodes = obj.nodes || [];
var lines = (obj.label || '').split('\n');
var splitter = '\n' + prefix + (nodes.length ? chr('│') : ' ') + ' ';
return prefix
+ lines.join(splitter) + '\n'
+ nodes.map(function (node, ix) {
var last = ix === nodes.length - 1;
var more = node.nodes && node.nodes.length;
var prefix_ = prefix + (last ? ' ' : chr('│')) + ' ';
return prefix
+ (last ? chr('└') : chr('├')) + chr('─')
+ (more ? chr('┬') : chr('─')) + ' '
+ archy(node, prefix_, opts).slice(prefix.length + 2)
;
}).join('')
;
};
https://github.com/substack/node-archy
So what?
2000 - 2010: The golden era of the software monolith
2010+: SOA all the things!
2014+: “The great unbundling”
Module-driven Development
Modularity in the enterprise
• Monoliths represent a huge business risk
• Optimise for “throw-away-ability”
• Business and code agility
• Webscale!
This is Node’s natural home
Module-driven Development
The Future of Node
• npm focused on module-driven development
• Service-focused infrastructure libraries
• Continued evolution of versioning conventions
• Continued discussion about transitive dependency
problems
• Module-driven development for the browser
• ES6 Modules?
Module-driven Development
Eh?
• Node's core contains mostly essentials
• Constant debate about what gets in
• npm & Node's modularity enables a vibrant
ecosystem
• Experimentation pushed to the edges
Small Core, Vibrant Ecosystem
So what?
"The standard library is where modules go to die." —
Kenneth Reitz
Small Core, Vibrant Ecosystem
So what?
Not stuck with as many "bad parts" forever
• Domains?
• Streams2?
• <insert pet-hate Node-core feature here>
Small Core, Vibrant Ecosystem
So what?
Experimentation!
• Build tools: Grunt, Gulp, etc.
• Browser tools: Browserify, WebPack
• Level*
• StackGL, etc.
• Desktop application tooling: NW.js, Atom
• IoT & robotics
• Languages & language features
Small Core, Vibrant Ecosystem
The Future of Node
• Core fiercely guarded
• Difficulty adapting core to new language features
• Tension with V8’s expansion
• StrongMode, SoundScript
• Intl
• Improved support for userland extension (NAN!)
Small Core, Vibrant Ecosystem
Eh?
• Node was born in the GitHub era but is pushing at the
boundaries
• Many projects adopting liberal governance
• io.js, request, level*: OPEN Open Source
• Contributors are embraced as owners
• Small modules make this easier
New Models In Open Source
So what?
• The Node community is more embracing and
cohesive
• Learning and up-skilling is accelerated via
responsibility
New Models In Open Source
The Future of Node
Node is pioneering new governance models for next
generation Open Source
New Models In Open Source
https://twitter.com/seldo/status/580536539047940096
• Open governance
• Rapid iteration
• New relationships with the V8 team
• Embracing the future
io.js
• Debuggability & insight
• Better streams
• ES6 and beyond:
• Track stable V8 releases
• Focus on async APIs
• Better number support!
• New server platforms: ARM64
io.js Mapping the Future of Node
An LTS Strategy
• Backed by companies like NodeSource
• Pick-a-branch and support
• Likely similar to Ubuntu LTS model
io.js Stability & Support