Live data from Hacker News

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

codeslinger.posterous.com

31–40 of 100 posts

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

#31
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?

Both.

If you're working on a project where I/O blocking is your primary performance issue, Node has a lot to offer in the form of a framework that helps and encourages you to structure your code in a way that works well for such tasks. Javascript's performance and its being single-threaded will have minimal impact, because those concerns are absolutely dwarfed by I/O costs in the situations Node's designed for.

On the other hand, if you're worried about how many threads you can run at once, then you're working on a task where CPU performance matters. That's not what Node is designed for. If you use Node anyway, you've decided to try hammering screws into place - and you should absolutely expect that it won't work out very well for you.

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

#32

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

Approaches that become popular and highly publicized definitely impact everyone else's work in that field. Teams decide to migrate to those approaches, discarding others, based on perceived popularity, shallow impressions, small amounts of experimentation. Often, this is all we have to go on. But team members who have an intuition that the approach may have more problems than are first visible now have a choice, to either silently go along with the new decision, or to document their reservations. The anger is an issue though. It's a product of when you perceive a waterfall of hype crashing over your own perception of better judgment (please note: perception. subjective viewpoint). It's worth it to try adjusting those perceptions since anger doesn't really get you anywhere.

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

#33
Node solves a problem I don't have in a so convoluted way that if I ever have that kind of problem I won't be using node for sure.

Is there a need for webstackers to go play at the server side? YES! but node is not THE solution, it is just ONE solution. I venture to say, as javascript evolves more towards a coffeescript flavor, then a coffeescript flavor on the server is what is needed.

And I'll support something along these lines.

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

#34
Nonsense. Perhaps your choice to use Node.js is suboptimal? That isn't an indication of Node.js's quality, it's an indication of your inability to choose the right tech. People choose tools that make it easier to do something, Node.js accomplishes that for a wide range of tasks.

I just spun up a IM API we needed in an evening thanks to Node.js and community contributed packages. It's humming along great, I even wrote up a piece about it: http://news.ycombinator.com/item?id=3547664

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

#36
Programming with Node's async model makes it extremely powerful and fast to run database queries and file functions in parallel, but the downside is the potential for huge callback spaghetti indeed.

But the callback spaghetti problem can be largely solved by dropping in, for example, the IcedCoffeeScript fork:

http://maxtaco.github.com/coffee-script/

Or the previous JavaScript TAME functionality:

http://tamejs.org/

There are of course many other async helper solutions as well, and if you're doing serious Node development, it's kind of insane not to use one of these.

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

#38
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?

It depends largely on what your scaling issues are. If you have requests that take a long time because of waiting for replies from web service calls, database calls, and the like, it will be a huge boon to scalability. If your CPU-limited, on the other hand, the non-blocking IO won't help you.

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

#39
Ok, as someone who has been actually building apps on Node for about 1 year AND working with a largish Scala codebase for the last six months:

> Not to mention the fact that its balls-ass slower than some straight un-optimized Scala.

I don't see the point of comparison here. Slower/faster is meaningless without the context. Apples to Oranges. And, Scala has it's own issues. Yeah, the JVM's performance is there, but bringing your team onto a Scala codebase is not easy either.

> It provides the least amount of aid and comfort to the programmer and its nigh-on-impossible to follow the code 6 months later.

Anyone who has developed more than a Hello World in Node will know that the problem of callback sphaghetti can be circumvented using events, promises and async libraries. Yes, until the language itself offers an async construct, this will be an issue, but frankly there are ways to get around it.

> JavaScript has very little support for any of those nice things: it doesn't even have namespaces, for chrissakes.

Client side JS has no module system. But Node.js has. At this point, I really wonder if the OP has actually worked at all with Node.

> It seems to me that people who are really crazy about Node.js are people who only knew JavaScript to begin with and to whom none of the above would ever even occur.

Another baseless claim. I urge you to go see the GitHub profiles of Node core committers. Seriously.

Post reply on HN