VN-INFO meetup 16/07/2014 at Officience, Paris	

Son NGUYEN KIM (@nguyenkims)
NODE.JS IS A PLATFORM BUILT ON CHROME'S
JAVASCRIPT RUNTIME FOR EASILY BUILDING FAST,
SCALABLE NETWORK APPLICATIONS. NODE.J...
NODE.JS IS A PLATFORM BUILT ON CHROME'S JAVASCRIPT
RUNTIME FOR EASILY BUILDING FAST, SCALABLE
NETWORK APPLICATIONS. 	

NOD...
PLAN
1. Introduction
2. Event-driven programming
3. JS becomes now a normal language
4. JS becomes now a wonderful languag...
I. INTRODUCTION	

Motivation	

History	

Main concept
NODE.JS IS USED BY BIGGEST COMPANIES IN
VARIOUS DOMAINS
MOTIVATION
HISTORY
• Created in 2009 by Ryan
Dahl	

• Sponsored by Joyent
Image copied from http://blog.newrelic.com/2012/07/11/recap...
event-driven programming !
MAIN CONCEPT
Image copied from http://kunkle.org/nodejs-explained-pres/#/conceptually-simple
II. EVENT-DRIVEN PROGRAMMING	

!
Single thread, multi-threading	

Event-driven programming definition	

Why JS is good choi...
SINGLE-THREAD
I/O
Read file
Main thread
SINGLE-THREAD
I/O
Read file
Main thread
Blocking ...
MULTI-THREAD
I/O
Read file
I/O
Query DB
Main thread
Thread 1
Thread 2
MULTI-THREAD
I/O
Read file
I/O
Query DB
Main thread
Thread 1
Thread 2
Manage concurrency :
lock everywhere !
Debug / Write ...
EVENT-DRIVEN PROGRAMMING
DEFINITION
Flow determined by events	

!
result = db.query(‘select * from facebook.users’)	

f(re...
Flow determined by events	

!
result = db.query(‘select * from facebook.users’)	

f(result)	

!
db.query(‘select * from fa...
EVENT LOOP
Image copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/EventLoop
EVENT LOOP
Image copied from http://www.aaronstannard.com/post/2011/12/14/Intro-to-NodeJS-for-NET-Developers.aspx
EVENT LOOP
Image copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/EventLoop
2 interesting propert...
WHY JS ?
• No mix of blocking and non-blocking IO	

• 	

Closure : no need to pass context around. 	

• First-class functi...
III. JS becomes now a normal language
• Interactive mode	

• Launch script without passing by html	

• Read file, connect t...
IV. A wonderful language for the web !
• Static web server with several lines of code	

• NPM	

• Lot of modules to work w...
V. Drawbacks
• Limited set of library : mp3, png ... 	

• Not hit 1.0 yet, still 0.10 (same as Hadoop with
version 0.23 .....
THANKSYOU !
Upcoming SlideShare
Loading in …5
×

Vn-info meetup on Node.js

525 views

Published on

Vn-info meetup on Node.js

These are the slides used at VN-INFO meetup on 16 July 2014.
This meetup is the 2nd one in the Javascript serie we organized.

To have more details, please use the slides' outline at http://goo.gl/9097I6
The example codes can be found on the GitHub repo at: http://goo.gl/53x39M. Do not hesitate to patch or create the issue if you find any !

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
525
On SlideShare
0
From Embeds
0
Number of Embeds
19
Actions
Shares
0
Downloads
7
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Vn-info meetup on Node.js

  1. 1. VN-INFO meetup 16/07/2014 at Officience, Paris Son NGUYEN KIM (@nguyenkims)
  2. 2. NODE.JS IS A PLATFORM BUILT ON CHROME'S JAVASCRIPT RUNTIME FOR EASILY BUILDING FAST, SCALABLE NETWORK APPLICATIONS. NODE.JS USES AN EVENT-DRIVEN, NON-BLOCKING I/O MODELTHAT MAKES IT LIGHTWEIGHT AND EFFICIENT, PERFECT FOR DATA-INTENSIVE REAL-TIME APPLICATIONSTHAT RUN ACROSS DISTRIBUTED DEVICES.
  3. 3. NODE.JS IS A PLATFORM BUILT ON CHROME'S JAVASCRIPT RUNTIME FOR EASILY BUILDING FAST, SCALABLE NETWORK APPLICATIONS. NODE.JS USES AN EVENT-DRIVEN, NON-BLOCKING I/O MODELTHAT MAKES IT LIGHTWEIGHT AND EFFICIENT, PERFECT FOR DATA-INTENSIVE REAL-TIME APPLICATIONS THAT RUN ACROSS DISTRIBUTED DEVICES.
  4. 4. PLAN 1. Introduction 2. Event-driven programming 3. JS becomes now a normal language 4. JS becomes now a wonderful language for the web ! 5. Drawbacks
  5. 5. I. INTRODUCTION Motivation History Main concept
  6. 6. NODE.JS IS USED BY BIGGEST COMPANIES IN VARIOUS DOMAINS MOTIVATION
  7. 7. HISTORY • Created in 2009 by Ryan Dahl • Sponsored by Joyent Image copied from http://blog.newrelic.com/2012/07/11/recap-of-nodeconf-2012/
  8. 8. event-driven programming ! MAIN CONCEPT Image copied from http://kunkle.org/nodejs-explained-pres/#/conceptually-simple
  9. 9. II. EVENT-DRIVEN PROGRAMMING ! Single thread, multi-threading Event-driven programming definition Why JS is good choice to do event-driven programming ?
  10. 10. SINGLE-THREAD I/O Read file Main thread
  11. 11. SINGLE-THREAD I/O Read file Main thread Blocking ...
  12. 12. MULTI-THREAD I/O Read file I/O Query DB Main thread Thread 1 Thread 2
  13. 13. MULTI-THREAD I/O Read file I/O Query DB Main thread Thread 1 Thread 2 Manage concurrency : lock everywhere ! Debug / Write / Test
  14. 14. EVENT-DRIVEN PROGRAMMING DEFINITION Flow determined by events ! result = db.query(‘select * from facebook.users’) f(result) ! !
  15. 15. Flow determined by events ! result = db.query(‘select * from facebook.users’) f(result) ! db.query(‘select * from facebook.users’, f) ! EVENT-DRIVEN PROGRAMMING DEFINITION
  16. 16. EVENT LOOP Image copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/EventLoop
  17. 17. EVENT LOOP Image copied from http://www.aaronstannard.com/post/2011/12/14/Intro-to-NodeJS-for-NET-Developers.aspx
  18. 18. EVENT LOOP Image copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/EventLoop 2 interesting properties : There is at most one event handler running at any given time. Any event handler will run to completion without being interrupted.
  19. 19. WHY JS ? • No mix of blocking and non-blocking IO • Closure : no need to pass context around. • First-class function : pass function as argument
  20. 20. III. JS becomes now a normal language • Interactive mode • Launch script without passing by html • Read file, connect to DB ...
  21. 21. IV. A wonderful language for the web ! • Static web server with several lines of code • NPM • Lot of modules to work with the web: cookie, tcp, parse json ... • Perfect match for client-side JS (ex: angularJS) • Horizontal scale
  22. 22. V. Drawbacks • Limited set of library : mp3, png ... • Not hit 1.0 yet, still 0.10 (same as Hadoop with version 0.23 ...) • IDE, debugger ... very primitive • Javascript inherent difficulties ?
  23. 23. THANKSYOU !

×