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
150
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
200
How to apply design principles in software engineering?
molefrog
0
310
Give a second change to Rails frontend!
molefrog
4
750
Heroes of Information Security
molefrog
4
200
Other Decks in Programming
See All in Programming
年間50登壇、単著出版、雑誌寄稿、Podcast出演、YouTube、CM、カンファレンス主催……全部やってみたので面白さ等を比較してみよう / I’ve tried them all, so let’s compare how interesting they are.
nrslib
4
780
Don't Prompt Harder, Structure Better
kitasuke
0
740
Cache-moi si tu peux : patterns et pièges du cache en production - Devoxx France 2026 - Conférence
slecache
0
200
Codex CLIのSubagentsによる並列API実装 / Parallel API Implementation with Codex CLI Subagents
takatty
2
910
Server-Side Kotlin LT大会 vol.18 [Kotlin-lspの最新情報と Neovimのlsp設定例]
yasunori0418
1
130
レガシーPHP転生 〜父がドメインエキスパートだったのでDDD+Claude Codeでチート開発します〜
panda_program
0
880
ドメインイベントでビジネスロジックを解きほぐす #phpcon_odawara
kajitack
3
740
Claude Codeをカスタムして自分だけのClaude Codeを作ろう
terisuke
0
120
事業会社でのセキュリティ長期インターンについて
masachikaura
0
250
クラウドネイティブなエンジニアに向ける Raycastの魅力と実際の活用事例
nealle
1
140
Laravel Nightwatchの裏側 - Laravel公式Observabilityツールを支える設計と実装
avosalmon
1
330
t *testing.T は どこからやってくるの?
otakakot
0
470
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
97
6.6k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
Become a Pro
speakerdeck
PRO
31
5.9k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
810
How GitHub (no longer) Works
holman
316
150k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.1k
Building AI with AI
inesmontani
PRO
1
890
The Mindset for Success: Future Career Progression
greggifford
PRO
0
310
A Modern Web Designer's Workflow
chriscoyier
698
190k
BBQ
matthewcrist
89
10k
The Language of Interfaces
destraynor
162
26k
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