I have started both to design web pages and to learn Java roughly ten years ago, back in 1996.
The first Web server I have ever used was a Netscape server. It came with built-in server side JavaScript and we were convinced that JavaScript would be a language of choice to develop server side Web applications.
Around the same period, I followed my first Java training. The instructor explained us that the real cool thing with Java was its virtual machine that can run everywhere and that, for this reason, Java would become the obvious choice for client side Web development.
Ten years after, we must admit that we got that completely wrong, that Java is mostly used server side and JavaScript is mostly used client side!
Will that remain true in the future?
I would be surprised if Java grew client side, but wouldn’t be surprised if JavaScript made a comeback server side.
Technically speaking, JavaScript is a good language, very comparable to scripting languages such as Python, Perl or Ruby and the fact that it is used client side for increasingly complex functions should justify to use it server side too.
There are good reasons to use the same language client and server side:
- Developers don’t have to learn different languages to work client and server side.
- It is easier to move functions from the server to the client or vice versa.
- Functions can duplicated client and server side.
Ruby on Rails and the Google Web Toolkit translate their source languages into JavaScript to solve similar issues, wouldn’t that be much easier if we could use the same language client and server side?
The duplication of functions is a point that I find really important.
Web 2.0 applications need to remain good Web citizen and serve full pages to clients rather than HTML place holders for Ajax applications.
If you want to do that while keeping the Ajax fluidity, you end up doing the same functions server side to build the initial page and client side to update page fragments.
In the first chapter of Professional Web 2.0 Programming, I show how you can use the same XSLT transformation client and server side to achieve this goal. However, there is a strong cultural push back from many developers to use XSLT and server side JavaScript should be a better alternative for them.
What should the ideal JavaScript framework look like?
There are already several JavaScript framework around, unfortunately all those that I have found follow the same templating principles than PHP or ASP.
For me, the killer JavaScript framework would be modeled after Ruby on Rails or Pylons.
Tell me if you find one!