What are these benefits? Are they really exclusive to Node? (or if not exclusive, then vastly simpler with Node)
What are these benefits? Are they really exclusive to Node? (or if not exclusive, then vastly simpler with Node)
It's a distributed pub-sub engine, so one client can publish an event, and the others on the server will receive it. Probably about half the code is shared between the server and client. That means less bugs and easier maintenance.
Technically there are tools that will convert, say, Haskell to Javascript so that you can have shared code between a client and server. In practice, I don't know anyone who does that. I'm sure for most it feels like a bit of a hack. So for practical purposes, the only way to share code between the client and server is by using javascript (or coffeescript) on the server-side as well. Node.js IMO is the best server-side javascript engine.
Instead, the examples of shared code in Node are always simple utility functions, validators and the like. While it helps not to have to rewrite those, it's not groundbreaking. Facilitating the sharing of state between client and server -- hopefully irrespective of the server-side language -- would be a much better goal, IMO.
I agree that JS-on-server is a nicer way to share code than compiling other languages into JS.
-No mental context switch when working on both ends
-Easier serialization (though JSON is pretty portable...)
-Sharing code
They aren't exclusive to Node and JS, but browsers run JS and will continue to for the foreseeable future. Since the front end can't budge its language at the moment, the back end has to.Seriously? A very common problem in web apps is validation logic is usually duplicated in JS and Server side language.
Node allows the same logic to be used in both cases. These are not a 'few little functions'. Validation is a central part of most business applications.
Given the potential to template html with javascript, and to code exclusively in javascript. You could end up with webapps written entirely in one language.
Whether that is a good thing or not remains to be seen, but it is something that we should pay attention to.
For example, validating a user's name on the client merely checks if the name's length is in a certain range and doesn't contain invalid characters. On the server it requires a query to the database -- possibly more.
I also reject the notion that there is a significant context switch involved in going from one language to the other.