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
Programming for Chaos
Search
shapeshed
May 17, 2012
Technology
190
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Programming for Chaos
An introduction to Node.js
shapeshed
May 17, 2012
More Decks by shapeshed
See All by shapeshed
Humans Networks and Chaos
shapeshed
3
1.8k
Other Decks in Technology
See All in Technology
AI フレンドリーなエラー監視を TypeScript で実現する
shinyaigeek
2
260
MIERUNE JCT 発表資料「宇宙から伊能忠敬ごっこ」
syuchimu
0
190
Amazon Bedrock AgentCore ワークショップ JAWS UG TOHOKU / amazon-bedrock-agentcore-workshop-jawsug-tohoku-2026
gawa
8
340
AI Adaptable なテストを整える工夫 / Ways to Make Your Tests AI-Adaptable
bitkey
PRO
3
220
コードレビューを制するチームがソフトウェアデリバリーのフローを制す / Beyond Code Review: Distributing Its Responsibilities Across the SDLC
mtx2s
4
1.2k
ポケモンの型をTypeScriptの型システムで表現してみた
subroh0508
0
340
ChatworkとBPaaS 異なる特性で学んだAI機能開発の ベストプラクティス
kubell_hr
2
2.9k
新規事業を牽引する技術選定 〜フルスタックTypeScript開発の実践事例〜
nullnull
3
360
noUncheckedIndexedAccess、3時間、1万円。 / noUncheckedIndexedAccess, 3 Hours, 10,000 JPY.
kaonavi
1
310
地元にいないローカルオーガナイザーの立ち回り
uvb_76
1
840
Building applications in the Gemini API family.
line_developers_tw
PRO
0
1.8k
Rubyで音を視る
ydah
1
100
Featured
See All Featured
Music & Morning Musume
bryan
47
7.2k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
エンジニアに許された特別な時間の終わり
watany
107
250k
The SEO Collaboration Effect
kristinabergwall1
1
480
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
160
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
1
160
Rails Girls Zürich Keynote
gr2m
96
14k
Test your architecture with Archunit
thirion
1
2.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
22k
Fireside Chat
paigeccino
42
3.9k
Designing for humans not robots
tammielis
254
26k
Transcript
Node.js Programming for Chaos
Who is this bloke? London-based Ruby and JavaScript developer at
pebble {code} Currently authoring Sam's Teach Yourself Node.js in 24 Hours. @shapeshed in the usual places
Don't Believe The Hype <3 <3 ZOMG THE New Railsz
!!!! Make Startup with Node.js === Profit I AM Node.js I AM HIPSTER!!!
Let's Chat! http://192.168.3.1
The Web Started Simple HTML Browsers http://
Then Became Dynamic cDatabases c Scripting Languages
It is different now
I'm easily excited
I'm cheap Galaxy Apollo £30 (refurb) • Clients are capable
• Clients can be servers
Learning from gaming 10 PRINT "HELLO LONDON WEB!" 20 GOTO
10
Your are in a large empty room There are exits
to the left or right. Left or right?
Input / Output Logic Left Princess!
This is predictable • Map scenarios • Write Code •
Easy!
We even write tests for this Scenario: Player Turns Right
Given I am asked to turn left or right When I choose to turn right Then I should see “Eaten by a dragon” Scenario: Player Turns Right Given I am asked to turn left or right When I choose to turn left Then I should see “You found the Princess”
Stop playing with yourself More difficult
Atari Joystick Joystick Output Logic Input(s)
Xbox Controller Internet 8 million controllers Game Servers Databases Chat
Servers Voice Servers Load Balancers Message Queues More..
A little language called JavaScript var perception = "Toy browser
language"; var reality = "The language of the web";
Browser wars V8 JavaScript Engine • Super fast • Highly
performant • Open source
A love-child is born 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 http://127.0.0.1:1337/');
Why JavaScript? Callbacks $("p").hide(1000); alert("This paragraph is hidden"); $("p").hide(1000, function(){
alert("This paragraph is hidden"); });
Why JavaScript? The Event Loop • Single Threaded • Return
fast • Don't Block
Blocking var fs = require('fs'); var data = fs.readFileSync(__dirname +
'/example.file','utf8'); console.log(data);
Non-blocking var fs = require('fs'); fs.readFile(__dirname + '/example.file', 'utf8', function
(err, data) { if (err) { return console.log(err); } console.log(data); });
You talk a lot. Show me something!
Node.js is a platform for • Network programming • Real-time
• High data throughput • Many concurrent users (It is one approach to concurrency)
When to use Node.js • Single page applications • Real-time
games • Network Mashups • Data streaming (file uploads) • JSON APIs
When not to use Node.js • CPU intensive applications •
CRUD apps on relational databases • Simple HTML sites • Just because 'IT IS SO HOT RIGHT NOW!'
Where next? • Express • https://github.com/visionmedia/express • Socket.IO • http://socket.io/
• dnode • https://github.com/substack/dnode • UK Training • http://leftlogic.com/training#node
Thanks! @shapeshed Slides: http://bit.ly/J9Qvbh