Live data from Hacker News

If you're using Node.js, you're doing life wrong

codeslinger.posterous.com

21–30 of 100 posts

Re: If you're using Node.js, you're doing life wrong

#21
I'm really pretty anti-node, but this article isn't very good. The concerns here are mixed up and not very thorough. All these points need graphs, charts, something solid to anchor them to. This is the sort of article that polarizes, but doesn't add to the discussion.

It starts off strong talking about a high bug count, but never gets into specifics there.

As far as scaling across cores goes, it's disingenuous to suggest that node can't do this, there are a number of options here. Message passing, for instance, does indeed work.

As far as nested callbacks sucking, I totally agree. But a walk through why would add a lot more substance here as well.

Re: If you're using Node.js, you're doing life wrong

#23
post #2

I don't really have a dog in this fight, but I see node.js as being "disruptive": * It's "not as good" as languages/environments like Erlang. * But it's good enough, and significantly simpler, as an approach to tackle a certain class of problems. This, combined with widespread knowledge of Javascript, will probably make it fairly widely used.

I was waiting for the disruptive argument in this thread.

The fact of the matter is that Javascript is currently (and for the forseeable future) client side language that runs without a plugin. If you want your entire stack to run on Javascript, then server side programming is the only way.

Projects like CoffeeScript are the earmarks of disruptive technology - getting something that doesn't fit most peoples needs to grow up quickly, fit everyone's needs, and destroy its competition before the competition even realized it was there.

Re: If you're using Node.js, you're doing life wrong

#25
post #19

I haven't used node.js before, but I see 2 main points being made about it, by proponents and detractors respectively: * It uses non-blocking evented IO so it can scale well. * It is single threaded so it can't scale well. Someone teach me: which of these statements is true?

Neither are true.

Non-blocking evented IO is mostly attractive from a usability point of view: it's much easier to write programs that aren't multi-threaded. It can also use much less memory than a threaded model in certain situations.

Non-blocking, evented systems tend to be single-threaded. Single-threaded systems don't automatically scale across multiple cores. To scale, you spawn a separate process for each core (for example, this is the suggested practice for node). You must then find some way for the different processes to communicate with each other, which is usually through a database (or some crazy pub-sub thing).

Node can scale just fine if you design your program to do so. It just scales in a different way.

Re: If you're using Node.js, you're doing life wrong

#26

If you get really angry about the choices other people make for their own work, you're doing life wrong.

Amen - I quickly learnt node.js to build http handler for the callback element of a tool I am building using authority labs - for what we need its the dogs nuts.

Re: If you're using Node.js, you're doing life wrong

#28
Node is not for every use case,

This tech talk on node is pretty interesting

http://sna-projects.com/blog/2011/08/nodejs/

I watched it last weekend, and from what I understood/remember from the talk the reason the node people picked javascript was not because they liked javascript. It was because they wanted to do async programming, and they found other languages had too much synchronous baggage. In javascript, node.js could start from a clean slate and build a pure async culture and environment.

Re: If you're using Node.js, you're doing life wrong

#29
Node is not for every use case,

This tech talk on node is pretty interesting

http://sna-projects.com/blog/2011/08/nodejs/

I watched it last weekend, and from what I understood/remember from the talk the reason the node people picked javascript was not because they liked javascript. It was because they wanted to do async programming, and they found other languages had too much synchronous baggage. In javascript, node.js could start from a clean slate and build a pure async cultural and environment.

Re: If you're using Node.js, you're doing life wrong

#30
post #19

I haven't used node.js before, but I see 2 main points being made about it, by proponents and detractors respectively: * It uses non-blocking evented IO so it can scale well. * It is single threaded so it can't scale well. Someone teach me: which of these statements is true?

They both contain some truth and some falsehood.

Essentially the first one is most right. Non-blocking IO can get a lot of work done as it is never hindered by doing nothing while waiting around for slow IO. It never blocks so it can always do work.

However, if a non-blocking system has too much work to do it can still max out a CPU. At this point you, ideally, need as many worker threads as you have CPUs.

However, a threaded system that doesn't use non-blocking IO runs the risk of having many blocked threads eating up a CPU & memory instead. This is largely dependent on the light-weight-ed-ess of the threads.

Both these systems are effected by how much work the server has to do to create a response, thus even non-blocking IO can become swamped if it uses a slow language, too much memory or the wrong algorithm, plus all IO must not block or else the non-blocking networking ends up waiting around for blocking files.

There are other complications too like the number of file handles a process can issue that can also impede a server and the number of clients it can simultaneously serve.

Post reply on HN