I like async, and I like node. However, for plain jane dynamic web apps, with no real time needs, I see it as being more of pain than using Ruby (or Python, or whatever).
Why? JS syntax kinda sucks for dealing with day to day business logic. Ruby is just more clear and easier to work with.
I think using node.js by default is bad design. It should be isolated to the cases where you need it.
I posted this info as a comment on the guy's blog (still awaiting moderation), but I thought you might find it interesting too, the point being that amazing things are possible with JavaScript and node.js, but if you're thinking single-file scripts with a tangled nest of callbacks and prototypal inheritance chains+constructors that are hard to keep straight, well ... there are better ways ......... :-D
As a JavaScript developer working with node.js (and client side scripts too, of course), I’d like to recommend a couple of related things:
Joose is open source, works with both node.js and in browsers, and there are various ways to install and leverage its libraries, e.g. npm:
http://github.com/isaacs/npm
This isn’t an advertisement. I started exploring node.js in early 2010, and my "discovering" Joose was a real boon as I was looking to do some complicated things that seemed daunting when trying to express the concepts in terms of prototypal inheritance.
Not everyone finds it attractive, but I’m always happy to spread the word in hopes that Joose can make someone else’s life and programming projects a little less stressful, which is what it's done for me.
If you find the syntax to be a problem - you may find CoffeeScript (http://coffeescript.org/) interesting. It emphasizes the good parts of JavaScript while minimizing the warts, all wrapped up in very nice syntax.
I don't think syntax is really that much of an issue. The fact is if you might expand to real-time apps later on, you'll have to write new abstractions all over again for stuff like fetching data, whereas if you started with something like node.js, you wouldn't. It's simply a matter of if you feel it's worth it or not, and it's really case-by-case.
"Everything is Async: Because the base environment has been built essentially from scratch, everything is asynchronous. This means there is no ‘defer to thread’ like in Twisted Python; You just can’t make blocking code."
This is not necessarily a good thing. Sometimes you need to write a piece of code that executes sequentially. Having the ability to do that if you need to is a good thing. Sometimes it can be unnatural and unwieldy to split a block of functionality up into a set of callback functions.
Yep. Your code ends up looking like the output of a continuation-passing transform, with every kind of sequential composition involving nested callbacks. It feels quite low-level and clunky and is one of the things I like least about writing Javascript on the browser.
Another thing is, when you go async, you're essentially giving up on using the language runtime's stack for most purposes. With that, you lose some useful functionality (useful stack traces, exceptions bubbling up).
Node.js is one of the most promising sounding projects I've seen in the last year in terms of something I may actually use in production code. JavaScript's agile syntax combined with ubiquity thanks to web browsers make it one of the few languages that would make switching to it bearable for, say, a Pythonista like me. And Node.js may be the final straw that unleashes it on the server-side.
While node.js has some appealing characteristics it doesn't seem to solve the main problem with realtime web apps -- coordination between the multiple client side view states and the server side state. It's easy enough to hack together communication between these two layers but it always feels a bit half baked. Something like etherpad should be the new hello world app.
Groupware is an extraordinarily difficult problemin this respect, especially if you want to handle the rare edge cases. The problem with maintaining multiple client side view states to be the same has a great deal of intrinsic complexity due to the very weak guarantees provided by network communication (if you want any kind of responsiveness whatsoever.)
So it is possible to write an entire webapp in Node.js? I think I'll try it out on my next project since I don't have experience in any web frameworks. I wonder if Node.js has any Postgres bindings.
http://expressjs.com/ is a good web framework for node, if you can get over the fact that their docs all assume that you know Ruby and have used the popular templating engines in it.
[+] [-] andrewvc|15 years ago|reply
I like async, and I like node. However, for plain jane dynamic web apps, with no real time needs, I see it as being more of pain than using Ruby (or Python, or whatever).
Why? JS syntax kinda sucks for dealing with day to day business logic. Ruby is just more clear and easier to work with.
I think using node.js by default is bad design. It should be isolated to the cases where you need it.
[+] [-] wallfly|15 years ago|reply
As a JavaScript developer working with node.js (and client side scripts too, of course), I’d like to recommend a couple of related things:
Joose3 — an object system for JavaScript which allows truly classful programming; use it to implement all sorts of meta-programming magic with ease: http://joose.it/ http://openjsan.org/doc/s/sa/samuraijack/Joose/3.011/lib/Joo...
JooseX.CPS — a continuation-passing-style "trait" for Joose classes which helps prevent your asynchronous code from turning into "callback spaghetti": http://joose.it/blog/2010/08/02/asynchronous-aka-non-blockin... http://openjsan.org/doc/s/sa/samuraijack/JooseX/CPS/0.11/lib...
Joose is open source, works with both node.js and in browsers, and there are various ways to install and leverage its libraries, e.g. npm: http://github.com/isaacs/npm
This isn’t an advertisement. I started exploring node.js in early 2010, and my "discovering" Joose was a real boon as I was looking to do some complicated things that seemed daunting when trying to express the concepts in terms of prototypal inheritance.
Not everyone finds it attractive, but I’m always happy to spread the word in hopes that Joose can make someone else’s life and programming projects a little less stressful, which is what it's done for me.
[+] [-] FlemishBeeCycle|15 years ago|reply
[+] [-] weixiyen|15 years ago|reply
[+] [-] enneff|15 years ago|reply
This is not necessarily a good thing. Sometimes you need to write a piece of code that executes sequentially. Having the ability to do that if you need to is a good thing. Sometimes it can be unnatural and unwieldy to split a block of functionality up into a set of callback functions.
[+] [-] mjw|15 years ago|reply
Another thing is, when you go async, you're essentially giving up on using the language runtime's stack for most purposes. With that, you lose some useful functionality (useful stack traces, exceptions bubbling up).
[+] [-] mkramlich|15 years ago|reply
[+] [-] weixiyen|15 years ago|reply
[+] [-] allertonm|15 years ago|reply
I thought there was fairly universal agreement that while javascript has many strengths, its syntax was not one of them.
[+] [-] percept|15 years ago|reply
[+] [-] equark|15 years ago|reply
[+] [-] simonw|15 years ago|reply
Doesn't solve that problem (which is really, really hard) but it's a very interesting step.
[+] [-] aaronblohowiak|15 years ago|reply
[+] [-] bostonvaulter2|15 years ago|reply
[+] [-] rpmcb|15 years ago|reply
http://github.com/ry/node_postgres
[+] [-] Grantmd|15 years ago|reply
[+] [-] flipp|15 years ago|reply