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
データ活用研修 データマネジメント【MIXI 26新卒技術研修】
mixi_engineers
PRO
4
460
それでも、技術なブログを書く理由 #kichijojipm / Why I Still Write Tech Blogs Even Now
shinkufencer
0
970
AI時代のPlaywright活用(システムテストを自動化する ー 実行エンジンにPla ywrightを選んだ理由)
ynisqa1988
2
1k
Git 研修【MIXI 26新卒技術研修】#2
mixi_engineers
PRO
1
260
GoでCコンパイラを作った話
repunit
0
170
『モデル + ハーネス』で読み解く AIエージェント入門
oracle4engineer
PRO
2
200
iOS/Androidの二刀流エンジニアがFlutter & TypeScriptへ越境後の現在地 - Flutterがメインになって見えた景色と現在の醍醐味 / Dual-Platform Mobile Engineer Shifts to Flutter & TypeScript - The View and Real Thrill of Going Flutter-First
bitkey
PRO
0
100
AIエージェントがあれば技術書なんてすぐ書けるでしょ→無理でした
watany
6
490
なぜ、あなたのエージェントは言うことを聞かないのか
segavvy
1
520
事業成長とAI活用を止めないデータ基盤アーキテクチャの設計思想
hiracky16
0
730
文字起こし基盤の信頼性
abnoumaru
0
140
データエンジニアこそ組織のオントロジーに向き合うべき — 問いに答えるAIから、事業を動かすAIへ
gappy50
1
400
Featured
See All Featured
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
440
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
400
YesSQL, Process and Tooling at Scale
rocio
174
15k
Rails Girls Zürich Keynote
gr2m
96
14k
Embracing the Ebb and Flow
colly
88
5.1k
Paper Plane
katiecoart
PRO
2
52k
Google's AI Overviews - The New Search
badams
0
1.1k
First, design no harm
axbom
PRO
2
1.2k
Test your architecture with Archunit
thirion
1
2.3k
The Pragmatic Product Professional
lauravandoore
37
7.4k
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