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
2
180
Programming for Chaos
An introduction to Node.js
shapeshed
May 17, 2012
Tweet
Share
More Decks by shapeshed
See All by shapeshed
Humans Networks and Chaos
shapeshed
3
1.8k
Other Decks in Technology
See All in Technology
【NoMapsTECH 2025】AI Edge Computing Workshop
akit37
0
230
AWSを利用する上で知っておきたい名前解決のはなし(10分版)
nagisa53
10
3.2k
テストを軸にした生き残り術
kworkdev
PRO
0
210
LLM時代のパフォーマンスチューニング:MongoDB運用で試したコンテキスト活用の工夫
ishikawa_pro
0
170
職種の壁を溶かして開発サイクルを高速に回す~情報透明性と職種越境から考えるAIフレンドリーな職種間連携~
daitasu
0
170
人工衛星のファームウェアをRustで書く理由
koba789
15
8.3k
Snowflake×dbtを用いたテレシーのデータ基盤のこれまでとこれから
sagara
0
120
実践!カスタムインストラクション&スラッシュコマンド
puku0x
0
530
💡Ruby 川辺で灯すPicoRubyからの光
bash0c7
0
120
ブロックテーマ時代における、テーマの CSS について考える Toro_Unit / 2025.09.13 @ Shinshu WordPress Meetup
torounit
0
130
株式会社ログラス - 会社説明資料【エンジニア】/ Loglass Engineer
loglass2019
4
65k
データ分析エージェント Socrates の育て方
na0
6
2.2k
Featured
See All Featured
A designer walks into a library…
pauljervisheath
207
24k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
930
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.6k
Building Applications with DynamoDB
mza
96
6.6k
We Have a Design System, Now What?
morganepeng
53
7.8k
Writing Fast Ruby
sferik
628
62k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
580
Statistics for Hackers
jakevdp
799
220k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
810
Agile that works and the tools we love
rasmusluckow
330
21k
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