asynchronous programming in node - mathunipdtullio/is-1/2016/seminari/async.pdf · what is node.js?...
TRANSCRIPT
Asynchronous programming in Node.js
1
Asynchronous programming in Node.js
2
Asynchronous programming
3
Asynchronous programming
4
Asynchronous programming
5
Asynchronous
6
English Definition of
Adjective1. Not occurring at the same time.2. Controlling the timing of operations by the use of pulses sent
when the previous operation is completed rather than at regular intervals.
Source:https://en.oxforddictionaries.com/definition/asynchronous
Asynchronous
7
English Definition of
Adjective1. Not occurring at the same time.2. Controlling the timing of operations by the use of events sent
when the previous operation is completed rather than at regular intervals.
Source: A. Maccagnan
8
One step back
9
What is Node.js?
10
Source: Giacomo Fornari, Flipped classroom. Sistemi Concorrenti e Distribuiti 2016/2017,
http://www.slideshare.net/GiacomoFornari/nodejs-concurrency-68682939.
What is Node.js?
What is Node.js?
● Event-driven● I/O● Server-side● Javascript environment● Based on V8
11
What is Node.js?
5. Event-driven4. I/O3. Server side1. Javascript environment2. Based on V8
12
What is Node.js?
5. Event-driven4. I/O3. Server side1. Javascript environment2. Based on V8
13
What is Node.js?
2. Based on V8
14
Source: https://www.diva-portal.org/smash/get/diva2:550993/FULLTEXT01.pdf
What is Node.js?
5. Event-driven4. I/O3. Server side1. Javascript environment2. Based on V8
15
What is Node.js?
5. Event-driven4. I/O3. Server side1. Javascript environment2. Based on V8
16
What is Node.js?
4. I/O
Source: Understanding the node.js event loop, http://blog.mixu.net/2011/02/01/understanding-the-node-js-event-loop
17
What is Node.js?
5. Event-driven4. I/O3. Server side1. Javascript environment2. Based on V8
18
What is Node.js?
5. Event-drivenMuch of the Node.js core API is built around an idiomatic asynchronous
event-driven architecture in which certain kinds of objects (called
"emitters") periodically emit named events that cause Function objects
("listeners") to be called.
Source:
https://nodejs.org/api/events.html#events_passing_arguments_and_this
_to_listeners
19
What is Node.js?
5. Event-drivenMuch of the Node.js core API is built around an idiomatic asynchronous
event-driven architecture in which certain kinds of objects (called
"emitters") periodically emit named events that cause Function objects
("listeners") to be called.
Source:
https://nodejs.org/api/events.html#events_passing_arguments_and_this
_to_listeners
20
What is Node.js?
5. Event-driven
21
What is Node.js?
5. Event-driven
Source: http://abdelraoof.com/blog/2015/10/28/understanding-nodejs-event-loop
22
Asynchronous programming
23
Must read: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function
ExamplesCode could be found here:
https://github.com/alemhnan/SWE.UNIPD
24