Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Got Milk? A short introduction to node.js and e...
Search
Alexey Taktarov
May 07, 2012
Programming
6
530
Got Milk? A short introduction to node.js and event-driven programming.
A short introduction to node.js and event-driven programming.
Alexey Taktarov
May 07, 2012
Tweet
Share
More Decks by Alexey Taktarov
See All by Alexey Taktarov
The challenges of web apps: what we’ve solved and what’s next?
molefrog
0
100
React Hooks: Iteractivity in Functional Components (RU)
molefrog
0
93
Practical Serverless & Edge Computing
molefrog
2
280
Дизайн принципы для разработчиков. Может ли дизайн сделать наши программы лучше?
molefrog
0
160
Hooks in action: implementing a 1KB React router
molefrog
0
190
How to apply design principles in software engineering?
molefrog
0
290
Give a second change to Rails frontend!
molefrog
4
720
Heroes of Information Security
molefrog
4
190
Other Decks in Programming
See All in Programming
開発に寄りそう自動テストの実現
goyoki
2
1.5k
Patterns of Patterns
denyspoltorak
0
380
TerraformとStrands AgentsでAmazon Bedrock AgentCoreのSSO認証付きエージェントを量産しよう!
neruneruo
4
2k
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
140
ThorVG Viewer In VS Code
nors
0
300
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
290
AI Agent Dojo #4: watsonx Orchestrate ADK体験
oniak3ibm
PRO
0
110
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
400
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
220
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
230
実はマルチモーダルだった。ブラウザの組み込みAI🧠でWebの未来を感じてみよう #jsfes #gemini
n0bisuke2
3
1.3k
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
10
1.5k
Featured
See All Featured
Believing is Seeing
oripsolob
0
16
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
4 Signs Your Business is Dying
shpigford
187
22k
Being A Developer After 40
akosma
91
590k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Speed Design
sergeychernyshev
33
1.4k
AI: The stuff that nobody shows you
jnunemaker
PRO
1
35
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
90
Marketing to machines
jonoalderson
1
4.5k
Are puppies a ranking factor?
jonoalderson
0
2.5k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
67
Transcript
Got milk?
None
milk = dear_son.please_buy_a_milk();
milk = dear_son.please_buy_a_milk();
milk = dear_son.please_buy_a_milk(); dear_son.thank_you(); milk.drink();
milk = dear_son.please_buy_a_milk(); dear_son.thank_you(); milk.drink(); Blocking operations
milk = dear_son.please_buy_a_milk();
milk = dear_son.please_buy_a_milk(); do_cleanup(); do_something_else();
milk = dear_son.please_buy_a_milk(); do_cleanup(); do_something_else(); /* ? dear_son.here_is_your_milk(); */ Non-Blocking
operations
Event-Loop
milk = dear_son.please_buy_a_milk(); /* Event loop starts - while(…) */
if( dear_son.milk_ready() ) break; do_some_cleanup(); /* Event loop ends */ Event-Loop
In terms of: 1. OS ( process, threads scheduling) 2.
Application ( event-loops, overlapped system calls, callbacks )
OS can handle it. So why should I know about
event-loops and other sh!t?!
That’s why
Introducing Node.Js! Event-driven I/O server-side JavaScript framework based on V8
Why Javascript? 1. It’s awesome 2. It’s simple 3. It’s
popular 4. V8 is really fast 5. Built-in support for callbacks, lambdas, closures and other magic
setTimeout(function() { console.log('Hello, '); }, 1000); console.log(' World!'); Dummy example
#1
Dummy example #2 var http = require(‘http’); http.createServer(function (req, res)
{ res.writeHead(200, {'Content-Type': ‘text/plain'}); res.end('Hello World\n'); }).listen(1337, '127.0.0.1'); console.log('Server running at port 1337');
Web-Server | CGI | php, perl, python, etc.
Node.Js (all-in-one: web-server, caching, parsing, templating, data-storing, doing-a-sandwich)
Features 1. Clustering 2. Packages: web-frameworks, DB, graphics, BNF parsers,
unit- testing, … + package manager 3. Cloud 9 IDE (runs in browser)
Problems Asynchronous logic hell!
Problems Asynchronous logic hell! 1. Using helper modules (deferred, async,
node-fibers) 2. Program is Finite State Machine
The main problem Node.Js is very young, so be careful!
Use it just-for-fun!
Resources 1. “UNIX internals” by U.Vahalia 2. “Thinking Asynchronous in
C++” by author of boost::asio http://blog.think-async.com/ 3. Online npm repository http://search.npm.js 4. Cloud 9 IDE http://c9.io
Have a nice milk! Speaker: Taktarov A. Drawings: Taktarov E.
molefrog[at]gmail.com