It goes like this:
Servers are expensive, but users will give you processing time in their browsers for free. Therefore for big sites server-side code is relatively expensive compared to client-side code. However, there are some things like data validation and retrieval that you can't leave to the client. You'd like to do them on the client, because it means faster response times for the users and less server infrastructure for yourself, but security and accessibility concerns mean that server-side code is required.
What typically happens is that you do both. You write your server side logic because you have to, but you also write the same logic in javascript in the hopes of providing faster responses to the user and saving your servers a little extra work in some situations.
Now since we're all (mostly) programmers here we should immediately spot the new problem. There's not only the extra work involved in developing two sets of the same logic, but also the work involved in maintaining it, the bugs that inevitably result because the platforms don't match up well, and the bugs introduced as the implementations drift apart a little over time.
Enter server-side javascript. The idea is that you can write code once, so that the same code runs on both the server and the client. This would appear to solve most of the issues. You get the full set of both server and client logic done all at once. No drifting, no double maintenance. It's also nice when your developers only need to know one language for both server and client work.
Unfortunately, in the real world it doesn't work out so well. The problem is three-fold:
- The server view of a page is just too different from the client view of a page. The server needs to be able to do things like talk directly to a database that just shouldn't be done from the browser. The browser needs to do things like manipulate a DOM that doesn't match up with server.
- You don't control the javascript engine of the client, meaning there will be important language differences between your server code and your client code.
- The database is normally a bigger bottleneck than the web server, so savings are minimal.
It's not an insurmountable technical problem: you constrain the server-supported language to a sub-set of javascript that's well supported across most browsers, provide an IDE that knows this subset and the server-side extensions, make some rules about page structure to minimize DOM issues, and provide some boiler-plate javascript for inclusion on the client to make the platform a little nicer to use. The result is something like Aptana Studio/Jaxer, which can be pretty nice.
But in the end, there are just too many pitfalls and little compatibility issues to overcome. Ultimately, as expensive as additional servers are they're still cheap compared to additional developers, and most programmers know how to be much more productive using something else.
What I'd really like to see is partial server-side javascript. When a page is requested or a form submitted the server platform does request validation in javascript, perhaps as a plugin to the web server that's completely independent from the rest of it, but the response is built using the platform of your choice.