node.js:
the smallprint
By ( ), 2013-05-30
Dominykas Blyžė @dymonaz
Slide 2
Slide 2 text
If you're ever in Vilnius...
Try to visit the Soviet Bunker (survival drama)
http://sovietbunker.com/en/
Slide 3
Slide 3 text
Node is street food.
,
And now you have diarrhea
@tomdale https://twitter.com/tomdale/status/291788972961701888
Slide 4
Slide 4 text
node.js sucks
Slide 5
Slide 5 text
node.js sucks
node.js is awesome, but terms and conditions apply -
prepare to have major headaches, also make sure to
refresh your vocabulary of curse words. The marketing
lies.
Does node suck, because
JS sucks?
WAT:
[
]
+
[
]
> "
"
[
]
+
{
}
> "
[
o
b
j
e
c
t O
b
j
e
c
t
]
"
{
}
+
[
]
> 0
{
}
+
{
}
> N
a
N
https://www.destroyallsoftware.com/talks/wat
http://stackoverflow.com/questions/9032856/what-is-the-explanation-for-these-bizarre-
javascript-behaviours-mentioned-in-the
You could be using PHP,
you know...
F
a
t
a
l e
r
r
o
r
: E
x
c
e
p
t
i
o
n t
h
r
o
w
n w
i
t
h
o
u
t a s
t
a
c
k f
r
a
m
e i
n U
n
k
n
o
w
n o
n l
i
n
e 0
http://phpsadness.com/sad/16
Slide 10
Slide 10 text
How often is JS the
problem?
Anyone ever WAT in production?
Slide 11
Slide 11 text
Does node suck, because
it uses a single thread?
Slide 12
Slide 12 text
Don't do Fibonacci-as-a-
Service
You don't take an airplane to go to work...
All our pages have onload of <1s on one core.
Slide 13
Slide 13 text
Does node suck because
it's not stable?
The core is only growing better!
Slide 14
Slide 14 text
One API to rule them all
m
y
F
u
n
c
(
.
.
.
, c
a
l
l
b
a
c
k
) { .
.
. }
c
a
l
l
b
a
c
k
(
e
r
r
o
r
, .
.
.
) { .
.
. }
Slide 15
Slide 15 text
Callback hell?
Use promises. Just do.
Slide 16
Slide 16 text
What does NOT suck in
node.js?
Slide 17
Slide 17 text
Speed
V8 and non-blocking I/O
Slide 18
Slide 18 text
Speed
Loads fast
Executes fast
Reads/writes fast
Dies fast
Slide 19
Slide 19 text
socket.io
Very stable
Just works
Slide 20
Slide 20 text
Shared* server/client
code
* unless you share what you shouldn't share...
Slide 21
Slide 21 text
So why does node.js
actually suck?
Slide 22
Slide 22 text
29k+ 31k+ modules
Slide 23
Slide 23 text
Unix philosophy?
,
I think I'll go write a new g
r
e
p
.
“
Write modules that do one thing well.
Write a new module rather than complicate
an old one.
”
@izs http://blog.izs.me/post/48281998870/unix-philosophy-and-node-js
Slide 24
Slide 24 text
Number of modules is
NOT a good indicator
Growth in number of modules is NOT an indicator of a
healthy ecosystem.
Slide 25
Slide 25 text
Sturgeon's Law
“ninety percent of everything is crap”
Slide 26
Slide 26 text
No content
Slide 27
Slide 27 text
memcache
https://npmjs.org/package/memcache
https://npmjs.org/package/memcached
#22: Incorrect detection of the record "END"
#45: data that contains "\r\nEND\r\n" gets
uncorrect result
Slide 28
Slide 28 text
Annoying bugs
Should not have happened:
"
s
ø
m
ė
š
†
®
į
ñ
g
"
.
l
e
n
g
t
h vs
B
u
f
f
e
r
.
l
e
n
g
t
h
(
"
s
ø
m
ė
š
†
®
į
ñ
g
"
)
M
a
t
h
.
r
o
u
n
d
(
M
a
t
h
.
r
a
n
d
(
) * x
)
/
s
o
m
e
u
r
l
?
q
Slide 29
Slide 29 text
Don't "this is OSS" me
Don't publish modules for "fame".
Must have a system for negative feedback.
Users need to be able to tag modules.
"We're awesome - fuck off" <- people will.
No more #KumbaYo.
Slide 30
Slide 30 text
Small modules and small
applications
Life is not small.
Business problems are not small.
Slide 31
Slide 31 text
Lots of small problems
<->
Several medium sized
problems
<->
One big problem
Slide 32
Slide 32 text
How often do you n
p
m
u
p
d
a
t
e
?
Every morning?
Then spend the rest of the day fixing bugs after the
update.
Also sucks*:
express
handlebars
n
o
d
e
_
m
o
d
u
l
e
s as a folder name
Native (compiled) modules
* not always, obviously. "it depends", obviously. Let's talk afterwards.
Slide 35
Slide 35 text
One language to rule
them all
Slide 36
Slide 36 text
Different patterns
What is absolutely bad is that if node.js won't be
minimally aligned with the rest of the code in the
browsers out there our life as "one language
everywhere" will become harder than ever.
,
@WebReflection http://webreflection.blogspot.de/2012/01/on-eventemitter-in-nodejs.html
Slide 37
Slide 37 text
OCD in coding is a good
thing.
Slide 38
Slide 38 text
"Async"
Having a callback does not your code "async" make.
Promises/A+ are always async
Slide 39
Slide 39 text
"Single-thread"
@horse_js,
“
single-threaded, but you still get race
conditions, how is this possible
”
https://twitter.com/horse_js/status/325982187772071937
Slide 40
Slide 40 text
Unagi
Slide 41
Slide 41 text
Culture
Slide 42
Slide 42 text
Via ,
@domenic https://twitter.com/domenic/status/338863854392057856
Slide 43
Slide 43 text
How do I contribute?
“battle-tested with billions of requests”
Slide 44
Slide 44 text
Who needs
documentation?
Code speaks for itself.
Except that it's Klingon. If you're lucky and also like Star
Trek.
Slide 45
Slide 45 text
Poor leadership Bad
influence Incomplete
evangelism
Callbacks vs promises
AMD
Phantom
Slide 46
Slide 46 text
Throwing away the
history
Futures - since 1970s
Promises - not just for control flow
AMD - the only way in the browser
Phantom - not node, not a browser!
Slide 47
Slide 47 text
The following applies to
ALL Java scripts
https://github.com/rwldrn/idiomatic.js/
http://www.youtube.com/watch?v=_EANG8ZZbRs -
Douglas Crockford: Programming Style & Your Brain
http://www.nczonline.net/blog/2013/05/28/on-the-
politics-cargo-culting-and-maintainability-of-
javascript/
Slide 48
Slide 48 text
JIFASNIF
JavaScript is fun so node.js is fun
If only we were already at the stage where we can only
play...
Slide 49
Slide 49 text
Lack of commitment
v0.0.1 - it's SO unstable that I don't even.
Slide 50
Slide 50 text
Leaders Influencers
saying "do whatever you
want"
Can you recommend Bitcoin kind of volatility to your
customers mom?
Collective responsibility does not work.
Self organization and evolution is too painful and too
slow.
Slide 51
Slide 51 text
"What trade-offs?"
Advocating without explaing trade-offs is more like
religion than programming.
There never is THE right way. Not even in node.js land.
Comma first means it's hard to insert items at the top.
Slide 52
Slide 52 text
Is node.js ready for
production? (v2013.05)
eBay ( )
LinkedIn ( , dust.js)
Microsoft ( )
Yahoo! ( , )
ql.io
API for mobile
Azure
YUI Mojito
Trello
Walmart
Slide 53
Slide 53 text
The pains of growing up?
These are not "teething" problems.
This is teenage immaturity.
LinkedIn dropped HTML5. Will they keep node.js?
Slide 54
Slide 54 text
Don't let node.js become
the IE of ecosystems
You can't build stable software if you have to rely on
buggy behavior.