It seems weird to me to have an interview with Ryan Dahl today, August 31st, without talking about the political struggle the Node Foundation has been going through over the past week. http://www.zdnet.com/article/after-governance-breakdown-node...
If you think back to when he quit node, it seemed to when it was due to not being interested in anything not involving the technology.
Interview with Ryan Dahl, Creator of Node.js
221–230 of 235 posts
Re: Interview with Ryan Dahl, Creator of Node.js
#222A serious problem with Node was the callback pyramid of doom. This means deeply nested callbacks such that the indentation wanders steeply to the right. When you do loops or have exceptions programming got very confusing. In effect you have to do a continuation passing transform. It's not difficult but the results are utterly unreadable. For example a simple for loop could be transformed into recursive function becau…
I love callbacks. The best thing about them is that you always know precisely what will happen when a line of code runs. Not so with promises.
Another nice thing is that you always know which line of code will run next. Not so with async.
I see async in the language spec (and class too) as a concession made to people who couldn't be bothered to learn how to use JavaScript the way it was intended. Like burgers on the menu at a Mexican restaurant.
And no judgement against them: I'm happy for them that they got the ruby-like JavaScript they always dreamed of.
But I wish those people would be a tad less boastful and understand that they turned people like me into exiles in our own language community. I used to have a language that promoted small single purpose modules with functional interfaces. That's gone. It's mostly synchronish OO interfaces now. And bigger and bigger frameworks. My folk are going to have to basically move out. I don't see an alternative at this point but to fork NPM.
Re: Interview with Ryan Dahl, Creator of Node.js
#223I can't help but feel like Google gently encouraged him to promote Go over Node. Or that being told by coworkers (goworkers?) for years-on-end that Go is better than Node has had an effect. Especially considering he talks about green threads like he's not quite sure what he's talking about. At any rate, there are many innovations where the creators weren't fully aware of their impact and eventually come to hate their…
Node lets you do single thread non blocking. Go lets you do multi threaded non blocking. That's a pretty substantial delta in the server world where you can easily have 24+ cores available. Memory and cpu footprint of go is also drastically lower to node as it is a compiled language. That makes a difference when you are running in a cloud paying per GB of memory and per core. I say this while actively developing in n…
Furthermore, not everyone is developing cloud-based apps and trying to optimize for metered cost structures.
If you need raw, parallelized, computational power, then I will without-a-doubt agree that Go is a better choice. However, to say that one would always use Go for any server (even webapps? come on...) truly doesn't make any sense.
The only other benefit-of-the-doubt explanation I could come up with for such an explanation is that it seems like the creator has spent more time in academia than in "the real world" of development, and perhaps the persuit of "the ultimate async system" is more important to him than practicality.
Re: Interview with Ryan Dahl, Creator of Node.js
#224Earlier quoted context omitted.
This was easily foreseeable when he started on Node.js. The Twisted framework for Python had existed for years (decades?) before Node.js was created. Anyone familiar with programming in that style knew of the issues with "callback hell". I was the primary instigator of generators for Python. Part of my motivation was to do something like CSP (e.g. call-with-current-continuation, call/cc) without having to redo the wh…
Somehow I never experienced callback hell. It always felt like every other code-nesting problem to me. I mean, nobody talks about conditional hell, everyone acknowledges that you should flatten out your conditionals.
Re: Interview with Ryan Dahl, Creator of Node.js
#225Re: Interview with Ryan Dahl, Creator of Node.js
#226Earlier quoted context omitted.
Your still missing the point. It's not that it was possible to do so. It's that you could quickly write web services idomatically that did so by default. Your example shows a simple hello world and doesn't speak to the point being made. I am sure you can get a more relevant example going in Scotty, but it appears that it didn't show up until 2012.
> Your still missing the point. No, I'm not missing the point. > Your example shows a simple hello world and doesn't speak to the point being made. Hmm... Let's do an analysis: * My example demonstrates reading from a given file descriptor (FD 0 -- stdin -- in this case), and that reading happens asynchronously (as I had pointed out, and even provided white papers describing how this works). Again, this is despite th…
function sendMessage(message, toClients, callback) {
var messagesSent = 0;
for(var i=0; iRe: Interview with Ryan Dahl, Creator of Node.js
#227Earlier quoted context omitted.
Your still missing the point. It's not that it was possible to do so. It's that you could quickly write web services idomatically that did so by default. Your example shows a simple hello world and doesn't speak to the point being made. I am sure you can get a more relevant example going in Scotty, but it appears that it didn't show up until 2012.
> Your still missing the point. No, I'm not missing the point. > Your example shows a simple hello world and doesn't speak to the point being made. Hmm... Let's do an analysis: * My example demonstrates reading from a given file descriptor (FD 0 -- stdin -- in this case), and that reading happens asynchronously (as I had pointed out, and even provided white papers describing how this works). Again, this is despite th…
Your indinctment that the reason people aren't using your language of choice as lazy is ironically lazy. There are plenty of practical reasons for using different languages and tools.
Re: Interview with Ryan Dahl, Creator of Node.js
#228Earlier quoted context omitted.
I said entirely typical , not that it was a dick-sized "challenge". A completely standard developer on .NET or PHP in 2008 was building pages that rendered at less than 10 requests per second. This is experience, not a guess, given that my role was improving the performance of those disasters. A completely average developer on node was building pages that was 10x to 100x better performance. Secondly, simply spawning…
> Secondly, simply spawning threads is laughably non scalable How else are you going to do it with a non-threaded language? I've ran well into the 10s of requests per second running "standard" PHP code on practically vanilla Apache configs. This was far from atypical and is no way any kind of challenge on a beefy machine. My job was not to clean up disasters though. Maybe if your job was to clean up disasters, your t…
Re: Interview with Ryan Dahl, Creator of Node.js
#229Earlier quoted context omitted.
> Secondly, simply spawning threads is laughably non scalable How else are you going to do it with a non-threaded language? I've ran well into the 10s of requests per second running "standard" PHP code on practically vanilla Apache configs. This was far from atypical and is no way any kind of challenge on a beefy machine. My job was not to clean up disasters though. Maybe if your job was to clean up disasters, your t…
The problem with multi threading like in PHP is that you need locks. It will not be a problem if you have low traffic but once you get hundreds of requests per seconds there's a high chance for errors like "double posts" where both threads say "post don't exist" and then both threads make the post, and you end up with double posts. Or racing conditions, double spending, etc. With NodeJS you get rid of all those probl…
Re: Interview with Ryan Dahl, Creator of Node.js
#230Earlier quoted context omitted.
The problem with multi threading like in PHP is that you need locks. It will not be a problem if you have low traffic but once you get hundreds of requests per seconds there's a high chance for errors like "double posts" where both threads say "post don't exist" and then both threads make the post, and you end up with double posts. Or racing conditions, double spending, etc. With NodeJS you get rid of all those probl…
The server spawns the threads and isolates the entirety of a single request to a single thread. It's not true language multithreading.
To get cpu bound parallelism in Node.JS you have to spawn child processes. There's a built in module in NodeJS called "cluster" that abstracts this a bit. When talking to a child process you could just as well be talking to another machine over the network, the code will look the same, and scaling horizontally across many machines will be easier, compared to languages that solve concurrency by using threads instead of non blocking IO.
There's a learning curve though. It took me about six months to learn how to do async programming, manage messages between different processes and machines, and callbacks, I do remember the "callback hell", but now it has become a second nature, it's like brushing my teeth, but more fun. I don't think half a year is that bad, you would need just as long time to get comfortable in any other language. And I consider JavaScript very newbie friendly, you don't need a CS degree to write JavaScript.