
Why I changed my mind about Node.js - calebm
http://calebmadrigal.com/why-i-changed-my-mind-about-nodejs/
======
sz4kerto
Oh, please, not that Paypal story again. Their legacy system was written on
platform/language X, then Z years later, they have written another in language
Y, and surprisingly, Y is faster! For Z>=5, this is going to be true for most
of X-Y pairs because people learn from their mistakes, people know more about
the requirements and pitfalls of their domain after having built the first
version, etc. etc.

Other than that, the article contains zero interesting information. Somebody
had an uninformed opinion of Node.js, then changed that opinion because he
heard some good stories, and now he convinces himself with funny arguments
that he's right.

(I had too many upvotes recently anyway :) ).

~~~
sheetjs
Let me try to give a different perspective on NodeJS:

We've been building tools to work with Excel files. The hardest problems
aren't related to writing code. It's all about finding files that use
different combinations of Excel features from different versions of Excel (and
files from external tools that read/write files). For example, if you start
from Excel 2011/2013, you wouldn't know about the custom smart tags that were
removed in Excel 2010. However, those records are still persisted (e.g.
BrtWbFactoid in XLSB), so you would need to produce a file from Excel 2007 to
actually reproduce the error.

For other people to discover errors in python or java libraries, they have to
try it in some capacity. That either involves installing something foreign
(which may be prohibited or undesirable) or submitting data to a third party
(which is most likely forbidden).

A pure-JS in-browser solution can address both problems effectively. We have a
cool little web demo which parses excel files in the web browser:
[http://oss.sheetjs.com/](http://oss.sheetjs.com/) No installation required.
Files are processed in the web browser (HTML5). We've received reports from
many organizations involving confidential data. Over time, we've built other
tools to inspect features of files without requiring that people send us the
original file, and this allowed us to test bugfixes without having to share
files.

Now for the really cool part: NodeJS exposes some features like Buffers that
make data processing competitive with python or other scripting languages. But
since it uses the same code for parsing, fixes to the web version immediately
benefit the NodeJS version. As a result, our server-side code
([http://npm.im/xlsx](http://npm.im/xlsx) and
[http://npm.im/xlsjs](http://npm.im/xlsjs)) benefits from the performance of
V8 and from the exposure that a browser-based solution enables.

~~~
debaserab2
That is a pretty powerful example - things like data importing are things that
I often end up needing to queue to process in the background. Offloading the
heavy parts to the client is a really awesome alternate solution. I'll be
saving this for the future for sure. Thank you!

------
y0ssar1an
tl;dr

    
    
        Other people are using it.
        It's less verbose than Java.
        It has a package manager and libraries.
        It has a REPL.
        I stopped worrying and learned to love callback hell.
        I didn't have to learn another language.

~~~
jaredmcateer
The article is not long enough to warrant a tl;dr even if such things were
welcome on HN.

Edit: my mistake, useless reddit joke posts are now welcome on HN, I missed
the memo

~~~
y0ssar1an
tl;dr

    
    
        I like reading.

~~~
_random_
You should be integrated into HN as part of the infrastructure.

------
drderidder
The author's experience are pretty typical for most newcomers to node (I help
run a large JS meetup, so get to meet a lot of them). But I think what many
people miss is that the functional programming and dynamic typing aspects of
JS (two of the most maligned aspects) turn out to be surprisingly effective,
often resulting in simpler, more concise code. Its a different mind-set from
the statically typed OO paradigm, and the learning curve isn't exactly easy,
but getting comfortable with functional programming and continuation passing
style in general is a great skill for any programmer to have.

~~~
debaserab2
Do you have any easy-to-grok real world examples/libraries you would
recommend? Genuinely curious and want to learn more. The JS code I end up
writing is always in a more traditional object-oriented style but I'm usually
not entirely satisfied with the end results.

~~~
sramsay
Might also recommend _Functional Javascript_ by Michael Fogus. He uses
underscore.js, and avoids re-implementing classic functional patterns (map,
reduce, filter, etc).

I understood a lot of functional concepts from Lisp before reading the book.
There might be something else you need first if you've had no exposure to FP,
But if your basic FP-fu is good, this is a really nice book to read.

------
kolev
The things that made Node.js big are npm, the community, and the fresh new
frameworks - a story similar to Ruby on Rails. But I have to fess up that I
miss C# and Java as their verbosity is actually an investment, not wasted
time. I'm really excited about Ceylon although it seems very slow pacing -
doesn't even support Java 8 yet. I've recently done some stuff in Groovy
(self-contained single-file utilities that download their dependencies from
Maven with no build process and dealing with binaries although Capsule seems
to be solving this perfectly nowadays). Anyway, one has to consider Dart as
well as it can spit out JavaScript for the client and still write everything
in one (saner) language. I really don't see myself doing a relatively large
project in Node.js.

------
sramsay
The thing that changed my mind about Node (and Javascript in general) was the
discovery of lo-dash and Immutable.

I really enjoy functional programming, and with those two libraries I feel
like I'm writing in something approaching Clojure (but with less ceremony,
faster startup times, a truly colossal user community/ecosystem, and less
memory bloat). I _never_ thought I'd say this about Javascript, but it clicks
off more items on my dream-language list than anything else I've used (and
I've used at least a dozen, across several paradigms).

It's honestly fun to write in JS these days (at least for me).

~~~
hashtree
Heck yeah, be sure to also check out:

    
    
      - https://github.com/puffnfresh/bilby.js
      - https://github.com/fantasyland/fantasy-land
      - https://github.com/baconjs/bacon.js
      - https://github.com/kriskowal/frb
      - https://github.com/swannodette/mori
      - And essentially all things PureScript: https://github.com/purescript/purescript

~~~
egeozcan
PureScript was something I've never heard of. Took me a few clicks to see some
code though:
[http://docs.purescript.org/en/latest/intro.html](http://docs.purescript.org/en/latest/intro.html)

The language looks good and it seems to be somewhat popular with more than 700
stars on GitHub. Thanks for the suggestion!

~~~
hashtree
It's an absolute dream come true for Haskell-ers. Doing server-side in Haskell
and client-side/small services in PureScript is... just wow. Anyone in the
Colorado area, we have quite a few amazing FP folks here (e.g. Brian McKenna)
and there is a PureScript meetup Oct 1st: [http://www.meetup.com/Boulder-
Haskell-Programmers/events/199...](http://www.meetup.com/Boulder-Haskell-
Programmers/events/199566292/)

------
abritishguy
I think the author is in the "honeymoon" period.

~~~
freehunter
Yeah, a repl, a package manager, and third party libraries are pretty standard
for many languages. Even Lua has them. Non-blocking is nice, but the last one,
I agree more on "the disadvantage is Javascript" than "but you only need to
know one language!" I'm not a Javascript fan, speaking as someone who recently
had to start developing in Javascript. I think it's a damn shame that this is
the language that everyone picked to create the Web with.

------
ericfrederich
Just an observation about these statistics: * Built almost twice as fast with
fewer people * Written in 33% fewer lines of code * Constructed with 40% fewer
files

When you choose a brand new language, the people doing the coding are ones
willing to learn / try new things. This means you won't have dinosaurs working
on your project.

~~~
calebm
Correlation vs Causation, yes.

------
ilaksh
I think people are herd animals. So when a few developers are using some new
tool, they are off by themselves away from the herd and considered idiots or
something. Then more and more start using that tool, and pretty soon the whole
herd, or all of the cattle around you, are doing that, and then you change
your mind.

I like using Node.js with ToffeeScript (which is a variant of CoffeeScript). I
liked Node before most people realized how cool it was. I am also sort of into
bash these days.

Down the line I would like to get into things like LiveScript and Nimrod.

And then down the line I would like to move on to some kind of system based on
description logics that makes it convenient to integrate systems because
programming languages and data can be translated to and from a common (DL-
based) language that can be reasoned on.

~~~
redblacktree
If you replace language names with band names, this sounds just like an
insufferable hipster riding a fixie in his skinny jeans talking about how he
liked Node before it was cool.

That's the joke? Or were you serious?

~~~
ilaksh
Maybe I should have left out the part about liking Node before it was popular.
The point was to try to give the idea that I had picked up on a trend before
some other people. The reason I want to get credit for that is because I want
people to use those other technologies that I like, so maybe someone reading
that will think that I can select technologies that, if nothing else, might
become popular in the future, and therefore decide to use the technologies I
mentioned.

Also, I hate hipsters and have no friends and am about the farthest from a
hipster you could ever be, BUT I _did_ have a "fixie" when I was a kid 30
years ago. That was because we were lower-middle class and my parents were
cheap though.

Also, I did finally purchase a pair of skinny jeans on the direct advice of a
lady friend last year. Despite having put on at least six pounds, they still
just about fit. Pretty amazing actually. It is a little embarrassing wearing
them outside, but if I am honest, they are my favorite jeans.

LOL.

------
pp19dd
What changed my mind about node.js was when I ran a demo program as a daemon
and then forgot about it for months. And it never broke.

Despite the program being very poorly constructed (by myself, of course), it
was still running reliably on the machine much much later. It's a simple
websocket (faye/bayeux) demo that allows multiple users to edit a grid
concurrently.

Plain version: [http://faye.pp19dd.com/](http://faye.pp19dd.com/) \- works on
iphones and such, and a HAL 9000 babylon.js version:
[http://faye.pp19dd.com/index2.php](http://faye.pp19dd.com/index2.php)
(Instructions: click on squares, use mouse wheel and such to move camera.)

At some point in putting the program together, I realized that I could write
modules that could work on both the client and the server without any
modifications. IE: client, server data structure. Maybe I'm rusty these days,
but mind was partly blown.

------
ioddly
Is there something special about node's REPL I'm missing? Just about every
language has one. IPython is pretty snazzy.

~~~
crimsonalucard
Articles like these often imply how node is infiltrating the same space that
JAVA takes up. Java to the best of my knowledge does not have a repl.

------
_jmar777
There was a load error when I first clicked the link, resulting in a blank
page. Was thinking "well played, punk".

~~~
calebm
Ha :)

------
anotherevan
I’ll admit I’ve always passionately disliked Javascript. I also have a strong
preference for statically typed languages over dynamic, but always thought
Javascript was the most unlikeable of the lot. Perhaps it is that I initially
learnt it by osmosis, trying to get things working under both Netscape and
early Internet Explorer browsers at the same time. Worrying if I put my curly
brace on the same line or the following line, or if I forgot a semi-colon at
some obscure, critical location.

But I’ve always been hesitant of dynamic languages in general, preferring
statically typed for any codebase of significant size. The last decade has
been a bit discouraging for me in this regard. First everybody was loving
Ruby, then seemed that Python has overtook it in attention. And then Node.js
came along and I really felt like Bromden with a pillow, looking for a way to
smother the insanity.

(As an aside, I do quite like Ruby as a language, and writing Coffeescript -
the wonderful lipstick for the pig that is javascript - has given me an
appreciation for the indentation feature a’la Python.)

The number one problem to my mind with using dynamic languages for a large
codebase is maintainability. Refactoring a compiled, statically typed language
is so much easier. There is so many potential errors that the act of compiling
and type checking eliminate for you that you don’t get with dynamic languages.
The focus on huge amounts of unit tests always seemed like compensation for
this. And refactoring code is so much easier. Add another parameter to a
function, try and compile and you find all the places in the code you need to
fix. Maintaining a sizeable amount of code, or code you haven’t looked at for
a while is so much easier.

And I get the feeling the pendulum of opinion is starting to swing back in my
direction. Running stuff in a web-browser is now a serious concern, and good
hackers are working on ways to portably do good programming in anything but
Javascript. From asm.js to Dart to PureScript and others.

Newer languages like Go and Rust are taking the nice features many have lauded
in the last decade as the advantages of dynamic languages. Things like good
package management, less boilerplate and such, and baking them into static
languages. So my outlook is getting rosier.

------
buckbova
Coming from an IIS, .NET, SQL Server background, the simplicity of full-stack
javascript from mongo, to node, to angular cannot be overstated. Propagating a
change from the front to the back end or vice versa is much easier and faster
speaking the same language throughout.

Tools like yeoman, grunt, bower makes it that much more pleasant.

Libraries like expressjs, mongoose, passportjs, and many more can do a lot of
the heavy lifting, taking away some of the pains of writing boilerplate.

All and all I'm a fan. I'd love to use angular against firebase only without a
node server, but I can't justify the cost.

------
ericHosick
"JavaScript can be the native format of your data"

I don't think developers appreciate how amazing this feature is in a language.

Code should be a data-structure giving you all the benefits of data-structures
including persistence.

~~~
calebm
Closer to homoiconicity, but not quite there.

~~~
ericHosick
Ya. Exactly. I like that term.

~~~
rubiquity
Not exactly at all. Homoiconicity is when your program can be represented as a
data structure. Like, literally a data structure. JavaScript doesn't even come
close to that.

------
untog
I work in JS all the time, but was still a little skeptical of Node until I
finally grasped the concept of Promises (the Bluebird library being my
preference). It took the callback-driven, event loop system from a liability
to a huge bonus - running operations in parallel is so simple now, and error
handling is a breeze. Can't recommend it enough.

Now I'm spending my time writing view code that can run on both the server and
client, allowing me to render the same stuff statically (for fast initial load
and SEO) and dynamically on the client (for fast page changes).

~~~
sillysaurus3
Do you happen to have any example code? I've had some bad experiences with
"callback hell," so it's interesting to see that there are ways to prevent it
from becoming a problem.

~~~
untog
One of my favourite parts of Bluebird is the 'Promisify' function. It allows
you to take existing Node modules and use them as promises. Here's an example
of interating over an array of files, only writing ones that don't already
exist:

[http://pastie.org/9559209](http://pastie.org/9559209)

It's also one of the reasons that I've ended up liking CoffeeScript more -
Promises have a lot of function() and return statements, CS makes that kind of
code a lot cleaner. For instance, that JS could be this short in CS:

    
    
        Promise.filter files, (file) ->
            fs.existsAsync(file).then (doesExist) -> !doesExist
        .each (file) ->
            fs.writeFileAsync(file.filename,file.content)
        .then ->
            Promise.map files, (file) -> fs.readFileAsync(file,'UTF-8')
        .then (fileContents) ->
            console.log(fileContents);
            ###
            Will return:
            [
                "File 1 Content",
                "File 4 Content",
                "File 3 Content"
            ]
            ###
        .catch (err) ->
            # This will catch any and all errors that happened above.

------
sergiotapia
This article is literally counting the same reasons listed every time nodejs
is mentioned, since it's inception.

Non-blocking, single-language, npm. What's new?

------
ziemo
OK, but what's about Java's vert.x framework or some asynchronous web-
container like undertow and CDI usage? Does that stuff are really so slow and
painfull in compare with NodeJS? I don't think so.. I think that there is
nothing bad with using "old" Java Enterprise Stack, as long as you are really
sure what you are doing and you really know (not guess) what to use!

------
anonyfox
The biggest step forward for JS development is Meteor, hands down. For
anything "appy", the productivity is just insanely good.

~~~
mackwic
I wrote another comment explaining why I strongly disagree with you (and the
Meteor thing) but after reading it I found it harsh and stuffed with
negativity.

So yeah, I very much disagree with you, but hope I will be wrong and Meteor
will be usable for more than a blog or prototype.

~~~
mark_l_watson
Just curious: I like Meteor but it does not seem appropriate for apps that
need to have a huge number of concurrent users. The developer experience is
sweet though.

What don't you like about Meteor?

------
pearjuice
Node.js is like that cool new kid on the block who is super easy to get around
with and before you know it you are best friends forever and he sleeps on your
couch regularly. After a few days the coolness wears off. He has flaws, too.
Irritations. Annoyances. But, do you really want to go back to your old
friends? Who are a magnitude less cooler but better for you in the long run?

I decided to do the latter and get actual stuff done. Node.js is fun and all,
don't get me wrong, but once you get over the hype and really dive into it you
are better off with Java.

~~~
sramsay
I'm trying to think of a single language of which this is not true. It's
certainly not Java. That dude is drinking all your beer.

------
hartator
I think the main issue with Node.js is that it is still being labeled as
"unstable", that implies several things:

\- At any time, the core team can drop the support of the 0.x versions \- NPM
is still bugguy compared to gem or pip \- The "vision" is something that might
change radically. (c.f. the recent issues with some core collaborator)

~~~
ilaksh
Actually that is something that confuses people unnecessarily. There have been
stable releases for a long time.

The vision absolutely is not going to change, and as far as I know the issues
with the core contributor were quite a long long time ago.

Anyway every project has issues with people. But at this point, Node is
probably right up there actually if you were to make a list of projects that
had the least likelihood ever of being impacted by politics. Just because
there is such a huge enthusiastic community, great package manager and culture
of modular development, etc.

------
mmset
I had exactly the same experience! Can't agree more with the article.

------
mrbonner
YANN (yet another node nut)

~~~
calebm
I wouldn't use Node for everything. I use Python more often, and also use some
C#. I'd like to do more Clojure.

------
frugalmail
This is an idiotic thing to do.

\- JS is difficult to maintain

\- JS is difficult to statically analyze

\- Callback hell is a stupid thing to voluntarily subject a team to

\- JS is notoriously difficult to debug

\- It's much harder to find "good" JS resources, but much easier to find "bad"
or "mediocre" JS resources

~~~
mackwic
Same goes for C and C++, pretty much exactly the same. Well, I have some bad
news for you... :)

It's not because it's JS that we can fire the architect, SOLID principles
(yes, they still are quite good practices), and abandon all sane project
management.

Truth is, there's no silver bullet, it's always a trade-off, blah blah blah.
In the end, I found it easier in JS than C to adapt the quality management of
the project with it's criticity.

Yep, I have some slightly critic components which run in JS right now, and I'm
OK with that.

------
galfarragem
_Javascript is a good girl to marry_

My crush is Ruby and probably will always be. She is beautiful but sometimes
her mind is slow and I always liked fast girls. She is great girl, don't get
me wrong, but not to marry. I'm afraid one day she will run away. In my street
there are also 2 sisters, Lisp and Clojure. A cousin of them (Autolisp) was my
first real girlfriend but we grew apart. Lisp, the older sister, was the most
beautiful woman I ever met, it's a pity she is too old for me. Her younger and
gothic sister (Clojure) is still a teen and unpredictable. Anyway their family
is not very apreciated in my town, people say that they are weird and anti-
social. I like them but what would my parents say about a relationship like
this?

Then there's Javascript. I don't have a passion for her, neither she is the
most beautiful and perfect girl I know. Anyway she is good enough for me, I'm
just a hobbyist, not a ninja. She is the kind of girl that will be always
there for me. Slowly I will love her also, I'm sure of it. If I get really
bored I'll take her unstable but so damn pretty co-worker as a mistress
(Coffeescript) but I will never divorce Javascript, she's a woman for life.

Im 34. I played around already, I don't want to look for more women. I'm old
enough to marry and put on my leash.

My reasons to "marry" Javascript:

\- JS is present everywhere and will be for a long time. Coming from a
struggling field, I'm tired of begging for work;

\- I'm an hobbyist, JS still have a lot of amateurs, I'm still in time to jump
on board. It's the wild West now;

\- Autocad (my field) just got a JS API.. ;

\- Meteor. IMO it has a bright future: it's cool (it's a kids project), user
friendly (women involved in the development) and open to newbies (including
hobbyists from different fields like me)
[https://www.youtube.com/watch?v=Z3cOLFP-
ZyQ&list=UU3fBiJrFFM...](https://www.youtube.com/watch?v=Z3cOLFP-
ZyQ&list=UU3fBiJrFFMhKlsWM46AsAYw) (This short video of a Tattoo designer
running a business on Meteor was an epiphany for me).

 _Note: This is just an humoristic comment, don 't take it too seriously.._

~~~
aiiane
Am I the only one who is seriously tired of programming languages being
compared to women?

I know you're probably well intentioned, but that and a number of other things
in your post are pretty heavy on the stereotype side of things ("women = user
friendly" and "put on a leash" are two other examples) and it's the kind of
stuff that adds little bits of stress to my work day, which add up over time
since there are plenty of guys who do stuff like that without really thinking
or actively meaning harm.

You have some good points/language comparisons - could you phrase them in a
way that doesn't create unnecessary implications?

~~~
ChrisAntaki
The most attention grabbing part of your comment was when you quoted him as
saying _" women = user friendly" and "put on a leash"_. His actual comment
contains _" I'm old enough to marry and put on my leash"_, referring to
himself.

I understand why you didn't like his comment, but that doesn't justify the
misquote. That being said, if you couldn't read his comment well, I
understand. His comment's hex color is almost matching the background.

~~~
aiiane
The common trope when it comes to associating leashes and marriage is wives
having their husbands on leashes (and googling bears this out). If you think
that the statement in that post was actually meant to refer to something other
than the common trope, I'd be curious why.

If you do think it refers to the common trope, I'm curious why you think "my"
versus "a" makes a difference.

Regardless, the point of the quote marks in that parenthetical was to denote
common tropes that appear in his comment, not to use his exact language. I'm
sorry that their usage was confusing.

~~~
ChrisAntaki
> If you think that the statement in that post was actually meant to refer to
> something other than the common trope, I'd be curious why

Nope, we're in agreement there.

> the point of the quote marks in that parenthetical was to denote common
> tropes that appear in his comment, not to use his exact language.

Exact language can be important, especially when quotes are being directly
sequenced. In this case, sequencing two quotes with different subjects, while
modifying the second quote to be more subject agnostic, is problematic.

> I'm sorry that their usage was confusing.

No worries, sounds like you didn't intentionally modify the quote to redefine
the meaning at all.

