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
540
6
Share
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
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
140
React Hooks: Iteractivity in Functional Components (RU)
molefrog
0
110
Practical Serverless & Edge Computing
molefrog
2
280
Дизайн принципы для разработчиков. Может ли дизайн сделать наши программы лучше?
molefrog
0
180
Hooks in action: implementing a 1KB React router
molefrog
0
190
How to apply design principles in software engineering?
molefrog
0
310
Give a second change to Rails frontend!
molefrog
4
740
Heroes of Information Security
molefrog
4
200
Other Decks in Programming
See All in Programming
Understanding Apache Lucene - More than just full-text search
spinscale
0
150
[PHPerKaigi 2026]PHPerKaigi2025の企画CodeGolfが最高すぎて社内で内製して半年運営して得た内製と運営の知見
ikezoemakoto
0
310
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
1.2k
Claude Code Skill入門
mayahoney
0
450
Redox OS でのネームスペース管理と chroot の実現
isanethen
0
480
CS教育のDX AIによる育成の効率化
niftycorp
PRO
0
170
「効かない!」依存性注入(DI)を活用したAPI Platformのエラーハンドリング奮闘記
mkmk884
0
280
Java 21/25 Virtual Threads 소개
debop
0
310
Fundamentals of Software Engineering In the Age of AI
therealdanvega
2
300
RailsのValidatesをSwift Macrosで再現してみた
hokuron
0
140
The free-lunch guide to idea circularity
hollycummins
0
390
Codex CLI でつくる、Issue から merge までの開発フロー
amata1219
0
260
Featured
See All Featured
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
64
54k
AI: The stuff that nobody shows you
jnunemaker
PRO
4
500
Ruling the World: When Life Gets Gamed
codingconduct
0
190
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.8k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
920
How STYLIGHT went responsive
nonsquared
100
6k
Unsuck your backbone
ammeep
672
58k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
330
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.6k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.6k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
700
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