

Why Node.js? - mahadazad

I am a developer with a very strong PHP background. Experience over 5-6 years in PHP and related technologies.<p>For the past 6 months or so I have been totally working with nodejs and its eco-system. I do agree its blazing fast and has a very good eco-system. But I really don&#x27;t believe that it is that much strong in web-development. I guess the only stable web framework is Express. But you have to do alot in it to achieve things. After researching I found Sails.js is gaining popularity and has many features out of the box. But after trying it for a month or so, I found that its very much buggy. The thing that works on my local environment does not work in production, however it has the same technology stack with same versions.<p>npm packages are outdated, dependencies not updated. I wonder why there is so much hype about nodejs and what it is really good at?<p>What would you say?
======
TurboHaskal
Oh there are many benefits:

\- Need any specific feature? Just give NPM a quick search and you'll find not
one, but a dozen half-assed implementations. The wide range of unfinished,
poorly tested, not-invented-here packages giving the impression of a pragmatic
and vivid community guarantees that the platform won't lose its momentum
anytime soon. I mean just look at
[http://www.modulecounts.com/](http://www.modulecounts.com/)

\- It has a Windows installer so it works on Windows. Guaranteed!

\- Significant pool of young, cheap and over-motivated developers that are yet
to experience burnout. Not having to deal with employees' family
responsibilities or that COBOL dinosaur who just happened to forget his own
cubicle number is a big plus.

\- Running the same language on the server and the browser means you won't
ever have to learn another language. Sans the language that compiles to
JavaScript of the month, of course.

------
dugword
I think there are several great reasons to use Node.js.

First, JavaScript is a darned good language. It has some quirks, and some down
right awful parts. But they are easily avoided, and often can be automatically
detected by static analysis tools like JSLint, JSHint, etc.

Lexically scoped anonymous functions, closures, first-class functions,
immediately invoked function expressions, object literals, dynamic objects,
are all magical once you twist your brain into really understand how to
program in that paradigm.

And yes, other programming languages have combinations of these features and
maybe implement them better. But if you look at the other most popular
programming languages
([http://www.tiobe.com/index.php/content/paperinfo/tpci/index....](http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html))
JavaScript is really it for this sort of dynamic, functional-esque style
programming.

And popularity matters when you are looking for support, documentation, or
libraries to interact with other systems.

Secondly, asynchronous event driven programming is a truly powerful model. And
while you can do event driven programming in any language. Node.js treats it
as a first class citizen, with it's standard lib implemented as non-blocking
with callbacks.

But what really makes Node.js so awesome is the marriage of it's dynamic
nature with the event driven model. They just work so well together. Passing
functions as callbacks for events just works so elegantly compared to how'd
you have to do that in other languages. Building out constructs like promises
or event emitters is trivial because JavaScript is so flexible.

I think Node.js gets shoehorned into doing a lot of work where maybe it
doesn't make sense. I still use Perl/Python for CLI scripts. But for
distributed network applications, Node.js makes solving a lot of problems way
easier.

------
justus_
I still believe a lot of the hype for node comes from the absurdly large
number of js-only or virtually js-only developers who enjoy the idea of using
the language they have grown so familiar with everywhere where possible.

The trend gets accelerated because most new programmers start with javascript,
or soon switch to javascript because they see it as the one language they can
do "the most" with.

The fresh blood is, due to being new to programming, very explorative and
curious about platforms and such drive the use of (back then) experimental
tools up a lot.

I personally think that both PHP as well as javascript suffer from being
designed not just with flat-out bad syntax, but also for a rather narrow use
case and then being adopted widely for lack of widespread availability of
other tools.

As a result they are used in places they were not expected to be used and for
systems of scale that they were not intended to handle.

The backend of the future may run with node or it may run with PHP, I hope for
neither. There are languages out there with more powerful and safer
abstractions, with more carefully designed APIs and standard libraries that do
not just clutter the global namespace, with usable import functionality from
the get go and with type checking and -inference.

But that's just my two cents, I could be wrong :)

~~~
mahadazad
> "There are languages out there with more powerful and safer abstractions,
> with more carefully designed APIs and standard libraries..."

It would be really nice if you could name those languages and your experience
with them.

------
anonyfox
The best "framework" node.js has to offer is Meteor. Nothing beats Meteor for
rapid prototyping so far.

Node was the next big thing a few years ago, I was an evangelist by myself.
Today, drawbacks and backlashes appear more and more... so if you plan to
reorganize yourself or some products to node, you may just skip it.

I'm personally betting on elixir for everything that is related to "server" or
"service", and Rust for when you have to be very close to the metal (or
providing an optimized native function to elixir).

Using "universal"/"isomorphic" JS to build everything everywhere sounds good
on paper and feels exciting at the beginning, but later you have to deal with
these mountains of layers of wobbly code, when stuff begins to break badly.
Not to mention that JS becomes an ugly beast of a language, crammed with loads
of useful features without a thoughtful foundation. But, this is just my
experience.

~~~
mahadazad
I have not used Meteor yet. Hopefully I will give it a try. But still I see
many big companies converting to node.js and praising it in their blogs and
everywhere.

Big companies like facebook, paypal, etc are investing in javascript. Using it
in places where it was never thought of e.g. "react-native"

~~~
anonyfox
When you come from a legacy ball of mud in written in any language, a rewrite
alone brings loads of benefits if done properly. In most cases, the evented
design of node requires some re-thinking and forbids simple copy-paste of the
old stuff.

In addition, a good chunk of computing is pushed from the server to the
clients nowadays, reduces server load even more. Of course, your servers are
more idle if they have less to do.

The _course_ of JS is, that it is used in places never thought of. But I just
leave it at that.

Finally, I trust a proven tech, that is _designed_ to solve todays
performance/distribution/messaging problems and delivered for decades now
(elixir/erlang/OTP). Choose by yourself. Yeah, JS nowadays is like lego, you
can plug together anything already available, but then, lego is for kids and
isn't used for actually mission-critical things in the real world.

------
ksherlock
It's really good at generating hype...

Like PHP, it lowers the barriers for entry, so you get a lot of new users that
aren't aware of any CS prior to 2005 or so. But they like to write blogs and
you like to hang out on blog aggregator websites.

------
risyasin
Honestly my situation is similar to yours. Using PHP for web applications
mostly more than 8 years. I had many frustration with PHP over the years, but
it has a quite strong community & mature documentation, millions of code
samples. a dozen of giant MVC frameworks that some of them are famous as PHP
itself. what my problem in getting started with Nodejs was lack of
understanding JS's basics not even Nodejs itself (yea i was really blind &
fool but i was thinking that i knew JS) i was reading source codes of famous
libraries in Nodejs. Quickly I have seen my problem. i didn't knew JS even
though i was using it more than 8 years. i was unable to understand even the
basic libraries or frameworks. That moment was an illumination for me. then i
started to learn JS in real. i've read the famous JS books during 6 months.
with the decision of never try to code before fully understand. that was my
leap for being a better developer (it worked even for my PHP knowledge) by the
way i still read the books :)

After that 2 years i have developed more than 5 projects with nodejs. i still
don't have a stable MVC structure for expressjs (not like SF2 or ZF2 etc.)
keep changing it every project, improving. but it's a nice journey to learn
something new when you are 36 years old. now i have quite stable
vision/exprience right before starting a project while planning. Already
started to use task runners grunt/gulp, actually i have developed a deployment
app with nodejs & connected it with my own git server. i work way professional
& efficient than before. My humble advice is read the source codes of
Express.js Sails.js maybe even Backbone.js then see if there is any black spot
in your understanding. (if not that's nice of you :) ) Node.js is upto
something very nice for all web developers.

~~~
mahadazad
Well I am pretty good at javascript both es5 and es6. As I am full stack
developer having skills in both frontend (angular, react, gulp, grunt) and
backend. The only problem I am facing is to find a good and stable web
framework for nodejs. I tried Sails due to its popularity, but I found its
broken in many places, documentation is not updated and hence misleading. Two
days ago I started using Loopback uptill now I have not faced those issues
that I faced with Sails. Lets see how it goes. Which frameworks do you use in
production?

------
avoidwork
What you're describing now is how php was in the early years. I started using
it with 2.0, just after it upgraded from perl scripts. It's pretty different
~15yr later (I think it's going on 20 now). Give node some time to mature.

There's a lot more to node than express; that's like the jquery of node.js....
every one uses it, and usually not very well.

------
bricss
Try to read this -> [https://www.paypal-engineering.com/2013/11/22/node-js-at-
pay...](https://www.paypal-engineering.com/2013/11/22/node-js-at-paypal/)

And take a look at this -> [http://hapijs.com/](http://hapijs.com/)

------
thamizharasu
I have no experience with Sails.js But I worked with Meteor.js framework.

I spent a little time to understand the framework and was able to develop a
web application quickly. May be you can try that.

I have planned to post some regular blog posts / videos on my blog
(h2labz.blogspot.com) in the future.

------
romanovcode
Because it's super hyped and your managers force you to use it.

