SlideShare a Scribd company logo
1 of 15
Download to read offline
Node.js and meteor
Next generation web development for the realtime web

Martin Naumann - Software Engineer
Centralway Factory AG
Submission #386
AGENDA
●
●
●
●
●
●
●
●

What is node.js?
Why do you want it?
Comparison
Quick: express.js
Even quicker: meteor.js
Meteor.js example
To node or not to node
Alternatives

JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
What is node.js?
●
●
●
●
●
●

Javascript on the server
event-driven architecture
asynchronous I/O
scalable
based on V8
modular

"Yeah. Nice buzzwords. What's the point?"

JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
Why you want node.js?
●

One instance can handle lots of clients
○ reduced memory footprint
○ get more performance from existing resources
○ Benchmark: up to 1.600.000 concurrent requests

●

Use your frontend technology on the backend
○ you have Javascript in your application anyway
○ "Oh look, this looks familiar!"
○ You know your stuff: Callbacks, Closures, Asynchronity

●

It's modular
○ easy to connect pieces of code
○ easy to write network code
○ rapidly build complex applications
Level Two

JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
Comparison: "Elders of web dev" vs. node.js
●
●
●
●

●
●

HTTP is the base of all web applications
HTTP was synchronous.
Most of the web languages still are.
HTTP evolved:
○ AJAX
○ Websockets
○ Push
real-time web
Need for asynchronous technologies
○ all of which are a bit weird in PHP, Java, ASP, etc.
○ node.js is asynchronous and has ever been.

JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
Quick! To the web app - with express
var express = require("express");
var app = express.createServer();
app.get('/:msg', function(req, res) {
res.send(req.params.msg);
});

JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
What boilerplate code is left?
●
●
●
●
●
●
●

Setup the server
Route requests
Take care of HTTP
Data sychronisation
Persist data
Write an Interface (API)
Setup server-side and client-side code

JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
Why not have...
●
●
●
●
●

the code separated by conventions
the server automatically deliver it
automatic persistance
automatic synchronisation
automatically compensate latency

JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
Quicker: meteor.js - A real-time app example
"So I heard you wanted to implement a chat app"
●
Write a server and a client
●
transmitting messages in nearly real-time
●
with multiple chatrooms
●
users can pick a nickname
●
users can create rooms
●
What do you think how many lines of code this requires?
54.
Server and client together.
7 are blank.
JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
Meteor.js example: The server
var Rooms = new Meteor.Collection("rooms");
var Messages = new Meteor.Collection("messages");

Yup. That's it.

JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
Meteor.js example: The client I / II
Template.main.currentRoom = function (){
return Session.get("room") || false;
};
Template.rooms.availableRooms = function (){
return Rooms.find({});
};

JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
Meteor.js example: The client II / II
Template.room.events = {
"click #leave": function() {
if(!window.confirm("Leave this room", "Really leave?")) return;
Session.set("room", undefined);
},
"submit": function() {
Messages.insert({
"room": Session.get("room"),
"author": Session.get("name"),
"text": $("#msg").val()
});
$("#msg").val("");
}
};

JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
To node or not to node - that shall be the question
●

Where node does make sense
○
real-time applications
○
processing long-running or I/O intensive tasks

●

Where it doesn't make sense
○
static web pages
○
small web applications for standard CRUD

JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
Alternatives
●
●
●
●
●

Ruby: EventMachine
Python: Twisted
PHP: Photon
Java: javaeventing
Perl: Mojo

JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
Thanks for listening!
Questions?

Martin Naumann - www.geekonaut.de
Centralway Factory AG - www.centralway.com
martin.naumann@centralway.com
@AVGP - github.com/AVGP

More Related Content

Viewers also liked

Meteor node upnorth-bobdavies
Meteor node upnorth-bobdaviesMeteor node upnorth-bobdavies
Meteor node upnorth-bobdaviesMark Skeet
 
Meteor Deployment Planning
Meteor Deployment PlanningMeteor Deployment Planning
Meteor Deployment PlanningRandell Hynes
 
Meteor presentation
Meteor presentationMeteor presentation
Meteor presentationAndy Bute
 
Deploy meteor in production
Deploy meteor in productionDeploy meteor in production
Deploy meteor in productionMiro Radenovic
 
Offience's Node showcase
Offience's Node showcaseOffience's Node showcase
Offience's Node showcasecloud4le
 
Intro To Meteor (Las Vegas Ruby User Group Talk)
Intro To Meteor (Las Vegas Ruby User Group Talk)Intro To Meteor (Las Vegas Ruby User Group Talk)
Intro To Meteor (Las Vegas Ruby User Group Talk)Almog Koren
 
The End of Dinosaurs happened because of [a] Meteor
The End of Dinosaurs happened because of [a] MeteorThe End of Dinosaurs happened because of [a] Meteor
The End of Dinosaurs happened because of [a] MeteorAbderrazak BOUADMA
 
Meteor presentation
Meteor presentationMeteor presentation
Meteor presentationscandiweb
 

Viewers also liked (12)

Meteor node upnorth-bobdavies
Meteor node upnorth-bobdaviesMeteor node upnorth-bobdavies
Meteor node upnorth-bobdavies
 
Meteor Deployment Planning
Meteor Deployment PlanningMeteor Deployment Planning
Meteor Deployment Planning
 
Meteor presentation
Meteor presentationMeteor presentation
Meteor presentation
 
Deploy meteor in production
Deploy meteor in productionDeploy meteor in production
Deploy meteor in production
 
Offience's Node showcase
Offience's Node showcaseOffience's Node showcase
Offience's Node showcase
 
Meteor js
Meteor jsMeteor js
Meteor js
 
Intro To Meteor (Las Vegas Ruby User Group Talk)
Intro To Meteor (Las Vegas Ruby User Group Talk)Intro To Meteor (Las Vegas Ruby User Group Talk)
Intro To Meteor (Las Vegas Ruby User Group Talk)
 
Why meteor
Why meteorWhy meteor
Why meteor
 
Meteor
MeteorMeteor
Meteor
 
The End of Dinosaurs happened because of [a] Meteor
The End of Dinosaurs happened because of [a] MeteorThe End of Dinosaurs happened because of [a] Meteor
The End of Dinosaurs happened because of [a] Meteor
 
Meteor JS News
Meteor JS NewsMeteor JS News
Meteor JS News
 
Meteor presentation
Meteor presentationMeteor presentation
Meteor presentation
 

Similar to Next generation web development with node.js and meteor

Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008codebits
 
Practical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter SvenssonPractical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter Svenssonrajivmordani
 
Isomorphic JavaScript with Nashorn
Isomorphic JavaScript with NashornIsomorphic JavaScript with Nashorn
Isomorphic JavaScript with NashornMaxime Najim
 
WebDev Simplified React.js.pptx
WebDev Simplified React.js.pptxWebDev Simplified React.js.pptx
WebDev Simplified React.js.pptxSarikaPurohit1
 
Meteor - The next generation software stack
Meteor - The next generation software stackMeteor - The next generation software stack
Meteor - The next generation software stackHenrik Ingo
 
The Next Generation Software Stack: Meteor
The Next Generation Software Stack: MeteorThe Next Generation Software Stack: Meteor
The Next Generation Software Stack: MeteorMongoDB
 
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
"Node.js vs workers — A comparison of two JavaScript runtimes", James M SnellFwdays
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sailsBrian Shannon
 
Globant Week Cali - Entendiendo el desarrollo Front-end del mundo moderno.
Globant Week Cali - Entendiendo el desarrollo Front-end del mundo moderno.Globant Week Cali - Entendiendo el desarrollo Front-end del mundo moderno.
Globant Week Cali - Entendiendo el desarrollo Front-end del mundo moderno.Globant
 
Intro to creating kubernetes operators
Intro to creating kubernetes operators Intro to creating kubernetes operators
Intro to creating kubernetes operators Juraj Hantak
 
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...David Amend
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleDmytro Semenov
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js PresentationExist
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.jsDinesh U
 
web 2. 0 performance testing - Dave chadwick
web 2. 0 performance testing - Dave chadwickweb 2. 0 performance testing - Dave chadwick
web 2. 0 performance testing - Dave chadwickRoopa Nadkarni
 

Similar to Next generation web development with node.js and meteor (20)

Node.js Test
Node.js TestNode.js Test
Node.js Test
 
Node js
Node jsNode js
Node js
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
 
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
 
Nodejs
NodejsNodejs
Nodejs
 
Practical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter SvenssonPractical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter Svensson
 
Isomorphic JavaScript with Nashorn
Isomorphic JavaScript with NashornIsomorphic JavaScript with Nashorn
Isomorphic JavaScript with Nashorn
 
WebDev Simplified React.js.pptx
WebDev Simplified React.js.pptxWebDev Simplified React.js.pptx
WebDev Simplified React.js.pptx
 
Meteor - The next generation software stack
Meteor - The next generation software stackMeteor - The next generation software stack
Meteor - The next generation software stack
 
The Next Generation Software Stack: Meteor
The Next Generation Software Stack: MeteorThe Next Generation Software Stack: Meteor
The Next Generation Software Stack: Meteor
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
 
Globant Week Cali - Entendiendo el desarrollo Front-end del mundo moderno.
Globant Week Cali - Entendiendo el desarrollo Front-end del mundo moderno.Globant Week Cali - Entendiendo el desarrollo Front-end del mundo moderno.
Globant Week Cali - Entendiendo el desarrollo Front-end del mundo moderno.
 
Intro to creating kubernetes operators
Intro to creating kubernetes operators Intro to creating kubernetes operators
Intro to creating kubernetes operators
 
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js Presentation
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
web 2. 0 performance testing - Dave chadwick
web 2. 0 performance testing - Dave chadwickweb 2. 0 performance testing - Dave chadwick
web 2. 0 performance testing - Dave chadwick
 

Recently uploaded

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Next generation web development with node.js and meteor

  • 1. Node.js and meteor Next generation web development for the realtime web Martin Naumann - Software Engineer Centralway Factory AG Submission #386
  • 2. AGENDA ● ● ● ● ● ● ● ● What is node.js? Why do you want it? Comparison Quick: express.js Even quicker: meteor.js Meteor.js example To node or not to node Alternatives JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
  • 3. What is node.js? ● ● ● ● ● ● Javascript on the server event-driven architecture asynchronous I/O scalable based on V8 modular "Yeah. Nice buzzwords. What's the point?" JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
  • 4. Why you want node.js? ● One instance can handle lots of clients ○ reduced memory footprint ○ get more performance from existing resources ○ Benchmark: up to 1.600.000 concurrent requests ● Use your frontend technology on the backend ○ you have Javascript in your application anyway ○ "Oh look, this looks familiar!" ○ You know your stuff: Callbacks, Closures, Asynchronity ● It's modular ○ easy to connect pieces of code ○ easy to write network code ○ rapidly build complex applications Level Two JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
  • 5. Comparison: "Elders of web dev" vs. node.js ● ● ● ● ● ● HTTP is the base of all web applications HTTP was synchronous. Most of the web languages still are. HTTP evolved: ○ AJAX ○ Websockets ○ Push real-time web Need for asynchronous technologies ○ all of which are a bit weird in PHP, Java, ASP, etc. ○ node.js is asynchronous and has ever been. JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
  • 6. Quick! To the web app - with express var express = require("express"); var app = express.createServer(); app.get('/:msg', function(req, res) { res.send(req.params.msg); }); JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
  • 7. What boilerplate code is left? ● ● ● ● ● ● ● Setup the server Route requests Take care of HTTP Data sychronisation Persist data Write an Interface (API) Setup server-side and client-side code JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
  • 8. Why not have... ● ● ● ● ● the code separated by conventions the server automatically deliver it automatic persistance automatic synchronisation automatically compensate latency JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
  • 9. Quicker: meteor.js - A real-time app example "So I heard you wanted to implement a chat app" ● Write a server and a client ● transmitting messages in nearly real-time ● with multiple chatrooms ● users can pick a nickname ● users can create rooms ● What do you think how many lines of code this requires? 54. Server and client together. 7 are blank. JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
  • 10. Meteor.js example: The server var Rooms = new Meteor.Collection("rooms"); var Messages = new Meteor.Collection("messages"); Yup. That's it. JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
  • 11. Meteor.js example: The client I / II Template.main.currentRoom = function (){ return Session.get("room") || false; }; Template.rooms.availableRooms = function (){ return Rooms.find({}); }; JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
  • 12. Meteor.js example: The client II / II Template.room.events = { "click #leave": function() { if(!window.confirm("Leave this room", "Really leave?")) return; Session.set("room", undefined); }, "submit": function() { Messages.insert({ "room": Session.get("room"), "author": Session.get("name"), "text": $("#msg").val() }); $("#msg").val(""); } }; JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
  • 13. To node or not to node - that shall be the question ● Where node does make sense ○ real-time applications ○ processing long-running or I/O intensive tasks ● Where it doesn't make sense ○ static web pages ○ small web applications for standard CRUD JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
  • 14. Alternatives ● ● ● ● ● Ruby: EventMachine Python: Twisted PHP: Photon Java: javaeventing Perl: Mojo JAZOON’12: Rookie Award, Next generation web development, Martin Naumann
  • 15. Thanks for listening! Questions? Martin Naumann - www.geekonaut.de Centralway Factory AG - www.centralway.com martin.naumann@centralway.com @AVGP - github.com/AVGP