Web development is experiencing a major change at the moment. Users are demanding increasingly responsive and interactive web applications. The mobile web has taken off. And closed platforms like Flash are yielding to open standards like HTML 5.
In this presentation I’ll argue that the language that will underpin this revolution is JavaScript – despite it’s poor reputation. Furthermore, I’ll explain how JavaScript’s resurrection is being driven by a slew of new open-source technologies.
For video of this presentation, see http://www.youtube.com/watch?v=SiCD3Nbf810
23. var express = require('express');
var sqlite = require('sqlite');
var db = new sqlite.Database();
...
var app = express.createServer();
app.get('/bookings', function(req, res){
db.execute('SELECT * FROM bookings', function (error, rows) {
if (error) {
res.send(error.message, 500);
} else {
res.send(JSON.stringify(rows));
}
});
});
app.listen(3001);
24.
25. What Node is Not
Easy as synchronous programming
Full-stack web framework
A stable API
1 billion PCs world-wide\nGoogle/Apple/Twitter/Facebook know this\nSince 2001, has oscillated between 10th and 8th position (ruby 8th and 27th, python 4th and 13th, perl 5th and 10th, PHP 4th and 10th, VB 4th and 7th)\n
\n
- Don’t confuse the DOM with JavaScript\n- It’s actually a pretty nifty functional language\n\n
jQuery is not enough\n\n\n
MVC Scales\nMVC is well known\nKnockout.js/JavaScriptMVC/Sproutcore/Cappucino\nCreated by Jeremy Ashkenas\nUI Agnostic\nLightweight\nGot momentum\n
\n
Models and Collections:\n- Back-end synchronization\n- Event generation\n- Client-side validation\n
Views:\n- Intermediate DOM and models\n- Subscribe to events from both\n- Convention-based\n\n
Some people say JavaScript on the server, but that’s not necessarily the case\nJavaScript on the server is not new - there was LiveWire\nWhen you add IO, JavaScript becomes a fully-featured scripting language\n10K Connection Problem\n\n
IO: Network/Filesystem\nProcess Management\nModule system\nExtensibility\nCrypto\nHttp\n\nV8: \n1. Netscape invented JavaScript\n2. Microsoft let JavaScript stagnate\n3. Rise of Firefox (SpiderMonkey) and now Chrome (V8) has reinvigorated JS engine performance\n
npm:\n4300\nsupport for:\nunderscore\nmysql\ncouchdb\n\nexpress:\n- routing & request processing\n- view rendering\n- session support\n- middleware support via connect\n
\n
\n
Compiled to JavaScript, \nOptionally interpreted with Node\nInvented by Jeremy Ashkenas\nExcellent Rails support\nCompiler is written in CoffeeScript\n
\n
Significant Whitespace\nClasses - including easy superclass calls, etc\nAbbreviated hashes\nNo confusion about variable scoping var events = new Events();\n
Function notation\nAbbreviate ‘this’\nContext-setting\n20% less code!\n
Everything is an expression\nCan be added with libraries\nMap-like functionality built into the language\nThe value of a loop is an array of a loops iteration values\n