Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
Transcript
30 slides
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
More Decks by shapeshed
See All by shapeshed
Humans Networks and Chaos
shapeshed
3
1.8k
Other Decks in Technology
See All in Technology
常時稼働エージェントの作り方(Claude公式ブログを資料化)
minorun365
PRO
20
29k
「個社」ではなく「業界」の課題を解く AI 対話開発 ー 価値を広げる設計と、価値を守るエンジニアリング ー
ivry_presentationmaterials
4
870
OCI Artifact による自動運転タクシーに向けた OTA 基盤の構築
biwashi
1
300
みん強Lightning! データ基盤ひとりでできるかな
endonanana
0
200
gradle-best-practices 使ってみた
mikanichinose
0
230
Context parameters で作る!はじめての型クラス
kworkdev
PRO
1
180
[NW-JAWS DAY]「うちのAWS、インターネット出られないんで」― AWS外の自社サービスをPrivateLinkでシュッと公開する方法
ykimi
3
930
成長するID管理基盤における運用もコストも犠牲にしないオブザーバビリティ向上の実践 / Improving Observability for a Growing Identity Platform Without Adding Operational Burden or Cost
kaminashi
1
130
プラガブルで宣言的なソフトウェアファクトリーを支えるTypeScript
timakin
3
850
Webメール開発を大幅に変えたJMAPというゲームチェンジャー
tascript
1
460
現場に渡し、構造で守る AI エージェントを活用したセルフサーブのデータ基盤の運用
legalontechnologies
PRO
0
110
[関西Kaggler会 20261113] 続・コミュニティコンペのススメ
nejumi
0
200
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.7k
GraphQLとの向き合い方2022年版
quramy
50
15k
Paper Plane
katiecoart
PRO
6
55k
Web Performance Is a Journey [PerfNow 2026]
tammyeverts
2
150
YesSQL, Process and Tooling at Scale
rocio
174
15k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
520
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
3k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
61k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
580
Heart Work Chapter 1 - Part 1
lfama
PRO
11
37k