Hacker News new | past | comments | ask | show | jobs | submit login

The main reason Node.js is gaining popularity is because it is blazing fast, scales very well due to its IO + event driven architecture and it has the best support for websockets (see socket.io).

On the flip side, code can be hard to maintain and you need to be more disciplined so that you can read the code later otherwise it becomes a callback spaghetti. Doing everything through callbacks also requires a mental shift.

Like with everything in life, there are pros and cons and tradeoffs. So choose wisely :).




node.js isn't really that fast for traditional apps, but if you were to compare, it's pretty much on levels of nginx and it's actually slower serving static files. only in few cases node.js shows its power, i.e; real-time apps/games. i wouldn't build any full-blown websites in node.js. only a certain piece on the site i'd do it in node, like a widget or something.


Yep, you shouldn't be using node to serve static files anyway. This is something a reverse proxy such as nginx should do. Node can then be used to serve either as a pure API (serving json with express is the easiest way) for a webapp or render the webpages.


nginx is not a bad choice, but would instead recommend node-http-proxy for most projects (including production).

It's fast, easy to setup (npm install), and relatively hardened, while still keeping everything JS.

As for static assets, those should probably be served from a CDN anyway, if one is concerned with performance.


I agree about the CDN, even though for us performance is not so critical we need to use a CDN (yet). I didn't know node-http-proxy but it sounds interesting I'll check it out.


I agree. I would do the same but I couldn't find any examples of doing this on the web. One could potentially use Redis or a AMQP as a middleman to integrate node.js's push with a Rails app. If I get sometime on the weekend I would like to try this.


I'm sorry I don't buy JS code is hard to maintain analogy.

If you write modular and/or functional code, JS code bases can be just as easy / hard to maintain as any other language.


No problem. We can all have different opinions, but the good thing is we are all innovative, experimenting developers :).


Perhaps I'm missing something but how is this a matter of opinion? If one wanted to avoid callbacks, which were the OC's original issue with node, one would break up the callback spaghetti into distinct, possibly prototyped objects, and glue them together with node's events. How is that any more difficult to maintain than, say, Python classes? If anything, I personally like the ability to choose the coding style with JS in this case, e.g. callbacks are great for quick prototyping when you can't be bothered to organize everything properly from the get-go.


In a language like Ruby or Python by using Fibers or Co-Routines(Greenlets), one can get benefit of non-blocking IO at the same time avoiding code spaghetti.

Gevent in python for example is pretty popular and similar is the case with Em-synchony in Ruby.

I have used callback objects but really that is not even close to what one can achieve with Fibers or Greenlets.


Can you give an example? Thanks!


As silly as it sounds, one of my favorite aspects of Node is how ridiculously portable and modular it is. NPM makes everything a breeze, and (thanks to support from Microsoft) it actually allows easy development on Windows. I realize plenty of languages have their own package managers, but NPM is fantastic. The callback aspect definitely requires more discipline, but I'm glad that I've learned it.


I can not get along with your statement about difficulties to maintain the code. How bad programming can be considered a fault of the language?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: