Live data from Hacker News

Node.js - A Giant Step Backwards

fenn.posterous.com

91–100 of 117 posts

Re: Node.js - A Giant Step Backwards

#91
post #89

Earlier quoted context omitted.

No.

I can't understand why. Why?

For starters since it event based nothing can happen until you give back control to event loop. Secondly if you add another callback or errback to a Deferred that has already been fired it just calls it with the last result. Note, Deferred is much simpler than I imagine you are thinking it is. It does nothing to handle events it is just a first class way to represent the flow of code.

Re: Node.js - A Giant Step Backwards

#92
post #89

Earlier quoted context omitted.

I can't understand why. Why?

For starters since it event based nothing can happen until you give back control to event loop. Secondly if you add another callback or errback to a Deferred that has already been fired it just calls it with the last result. Note, Deferred is much simpler than I imagine you are thinking it is. It does nothing to handle events it is just a first class way to represent the flow of code.

so adding a callback runs it if there is a result. thanks

Re: Node.js - A Giant Step Backwards

#93
I would write something like this:

  function handler(yes, no) {
      return function (err, data) {
          if (data) {
              yes(err, data);
          }
          else {
              no(err, data);
          }
      }
  }

  function get() {
      function done(err, data) {
  
          // do something with data
  
      }
      function db() {
          asynchronousDb.query("SELECT * fomr something where id = 3244", done);
      }
      asynchronousCache.get("id:3244", handler(done, db));
  }

Re: Node.js - A Giant Step Backwards

#94

Earlier quoted context omitted.

What prejudices do I have against Node that are unfair?

I don't know, you said you were biased against it. That's what biased means. Maybe your education has failed you?

Being bias doesn't necessitate being unfair, we all have biases. It just means, all things being equal I'm not pro Node.

Re: Node.js - A Giant Step Backwards

#95

Earlier quoted context omitted.

So again, to you, what benefit does everything being built on this async, single-threaded, event-driven model give you? Sounds like not much. You could get all of those benefits + much cleaner code using threading or fibers or actors, but that does not make for C10K badassness, so here we are, with our callbacks. Also, I'd say I've written enough code on top of node.js to be qualified to comment on this. Here's some…

I get simple scalability, server-client code reuse, easy realtime, and, despite what you or others may think, I like Javascript as a language. Node.JS was also a perfect fit for the scraping framework I wrote: https://github.com/chriso/node.io At one stage I had the same train of thought that you have ( http://chris6f.com/synchronous-nodejs / https://github.com/chriso/synchronous/blob/master/lib/protot... ) - it woul…

> Is it worth the benefits I've mentioned? For me, yes.

This sounds like a tacit admittance that you're willing to deal with it because you don't think you have other options, but you do. There is at least one CPS compiler for Node (TameJS), and there are other languages that allow for the same result, but more straightforward implementations of concurrent code (Erlang, Ocaml/LWT, Haskell). I'm not saying you should use though, but we can do better and we should, even if it's just compiling back to JS in the end.

Re: Node.js - A Giant Step Backwards

#96

Earlier quoted context omitted.

> I recently wrote a project that needs to do 100's or 1000's of possibly slow network requests per second. The first try was Ruby threads. That was a disaster (as I should have predicted). I had an entire 8-core server swamped and wasn't getting near the performance I needed. I don't mean to be offensive, but welcome to at least the 1980s. We've known this doesn't scale for ages. The fact that you even tried it and…

> The fact that you even tried it and thought it might be a viable solution just shows your education has failed you This holier-than-thou attitude is exactly the thing that prevents more people from becoming educated on these kind of subjects. Knowledge and experience on these kinds of subjects are _not_ trivial and are _not_ easy to obtain! Information about what scales, what does not, and why, are scattered all ov…

If I told you that the Sun revolved around the earth, would you consider it holier-than-thou to tell me my education has failed me? The knowledge that the original solution (threads in Ruby for handling large numbers of concurrent connections) does not work is not a secret. Even with a peripheral following of Ruby it is well known that this solution would not work, not only is the base Ruby implementation slow but threads have been a known issue in it from day one. The solution is so misaligned with the problem that it is really difficult to validly argue this knowledge is too difficult to find. Yes, scaling to Twitter is another issue, but we're talking about the basics here.

But don't put words in my mouth, I didn't call anyone dumb, I said his education has failed him. This could be himself failing to properly research the problem space, it could be his school for not properly introducing him to the subject, it could be a whole host of things. I never argued he was incapable of learning (clearly he did). And I do spend a lot of time educating people, don't take a singular snapshot of a comment on HN as indication of how my entire life is spent.

Re: Node.js - A Giant Step Backwards

#97
post #77
post #68

Earlier quoted context omitted.

If I can run one app with 10,000+ concurrent requests on one server, then I can run a hundred apps with a hundred concurrent requests each on that same server. You can say that doesn't matter either, but the cost of hosting a web app just dropped 99%.

but the cost of hosting a web app just dropped 99%. The cost of hosting a webapp tends to be a rounding error in contrast to the cost of developing the webapp.

And now the cost of hosting a hundred webapps is just a rounding error in contrast to the cost of developing one. Isn't it nice living in the future?

The additional benefit is that I can take the same program and handle 20,000+ concurrent users on two servers— which is when I suddenly become very glad that my hardware costs are significant compared to my dev costs.

Re: Node.js - A Giant Step Backwards

#98
post #97
post #77

Earlier quoted context omitted.

but the cost of hosting a web app just dropped 99%. The cost of hosting a webapp tends to be a rounding error in contrast to the cost of developing the webapp.

And now the cost of hosting a hundred webapps is just a rounding error in contrast to the cost of developing one. Isn't it nice living in the future? The additional benefit is that I can take the same program and handle 20,000+ concurrent users on two servers— which is when I suddenly become very glad that my hardware costs are significant compared to my dev costs.

And now the cost of hosting a hundred webapps is just a rounding error in contrast to the cost of developing one.

That's a weird way to look at it, unless you're in the webapp hosting business? For everyone else there is usually only one webapp that they care about.

I can take the same program and handle 20,000+ concurrent users on two servers

Sorry to break it, but that's not how it works. Unless you have one of those rare webapps that never need to touch a database.

Re: Node.js - A Giant Step Backwards

#99
post #98
post #97

Earlier quoted context omitted.

And now the cost of hosting a hundred webapps is just a rounding error in contrast to the cost of developing one. Isn't it nice living in the future? The additional benefit is that I can take the same program and handle 20,000+ concurrent users on two servers— which is when I suddenly become very glad that my hardware costs are significant compared to my dev costs.

And now the cost of hosting a hundred webapps is just a rounding error in contrast to the cost of developing one. That's a weird way to look at it, unless you're in the webapp hosting business? For everyone else there is usually only one webapp that they care about. I can take the same program and handle 20,000+ concurrent users on two servers Sorry to break it, but that's not how it works. Unless you have one of tho…

Really? Show of hands, now, who here cares about one (and only one) webapp?

Anyway, what's good for the webapp hosting business is good for web developers, and what's good for web developers is good for the technical ecosystem in general (and then the world). Of course going from VPSes to EC2s was a significant improvement. But that isn't as good as it gets. EC2 rates were cheap already, but when Az started the free tier it represented a significantly lower barrier to entry. That's good for everyone.

And seriously, come on. This is a way of making programs run faster, and not a little faster, but a hundred times faster. It's the very definition of technological progress. It's absurd that we're here arguing about whether it matters or not.

Re: Node.js - A Giant Step Backwards

#100

It seems a bit cruel that he mentions "horror stories" about Twisted; most of the culture shock people complain about with Twisted is exactly the kind of flow-control shenanigans that he describes in Node.js. In fact, Twisted makes those particular examples easier. To handle branching flow-control like 'if' statements, Twisted gives you the Deferred object[1], which is basically a data structure that represents what…

inlinecallbacks also makes things easier, when applicable.
Post reply on HN