Why You Should Pay Attention to Node.Js
redmonk.com
redmonk.com
socket.addListener("connect", function () {
socket.write("hello\r\n");
});
is really not that different from responding to a click event on an element in jQuery. $("#my-element").click(function() {
alert('Element Clicked!');
});
I'm not saying that it will instantly make everyone a server side programmer, but it definitely makes the barrier to entry quite a bit lower. public void service(ServletRequest req, ServletResponse res) throws IOException {
res.getWriter().println("hello");
}
Yes, JavaScript is dynamically typed so you don't have to type the types.(Which it sort of did; I used to use JScript in ASP, but it's not quite the same.)
(Yes, I am the person who frequently compares Node.js to Erlang, unfavorably. But my objection is to the hype that Node.js is a unique and beautiful snowflake, rather than a retread of ideas done endlessly in other languages. I still think that on the whole it's a good idea, even if I don't think it can actually live entirely up to the hype, it can still do good things.)
Node.js will get better, but it will get spanked by Erlang at high loads and with lots of processes, and while there isn't nothing that Node.js can do about it, there's a limit to what they can do and still be JS.
(Interestingly, this is not necessarily true in general. It is particularly true here because Javascript is the colloquial term for ECMAScript, which is a standard. To get the requisite primitives in there would require changes that violate the standard, such as the execution environments and the way references are treated. A language that isn't standardized could change and still claim to just be the next version.)
Working with Node's callbacks for I/O feels a lot like working with jQuery's XHR/animation callbacks. It's a consistent flow that will feel familiar for a lot of js coders immediately. Speaking from personal experience, it really does help the brain keep moving.
Many javascript programmers are more than familiar with server-side development, they just haven't necessarily had a super productive environment within which to flex their skills, but that may be changing.
I think CommonJS is the more important project to consider here.
All the web world need is a way to print('<h1>Hello world</h1>') easily, no need to create servers and listen to ports to just spit some html, and there is where node fails.
V8CGI is an interesting option but lacks penetration.
Google could hit a home run if they provide NATIVE js on app engine (not rhino on top of Java)
Looks like Heroku is heading for the home run instead.
I'll be more explicit, this is all I want:
- open editor and type:
- response.write("<h1>Hello world!</h1>")
- save it as hello.js and run it
See? nothing else.Right now V8CGI is the closest to my dream I've found.
Node is cool and stuff, but lacking the layer of simplicity Joe scripter needs to write his family album or personal shop.
Abstract everything from me and just let me write html (without having to use any framework)
And no, it is not a special case, it is what 99% of web scripters today need. The other one percent are those who lurk around node.js in google groups, the brains behind the monster, the ones who want to compete with nginx and apache, those building frameworks and utilities, not the ones who write casual stuff who take a look and decide to go shopping while something easier comes along, count me among them.
It's still far faster than anything else I've used as far as response time. The other dynamic languages don't run as fast and it lacks the layers of filtering/abstraction that bog down the compiled languges.
For example, someone wrote the same example in eventlet, gevent, node.js, eventmachine, tornado and twisted. http://gist.github.com/376416
it's pretty obvious how to use gevent from your python code, how does one use node.js (without resorting to web frameworks, like Django etc.)
Javascript and node.js have a nice development story and I am trying to spin up a bit on Emacs support for Javascript.
It is better to put together what is great, than reinvent the wheel.