What about Sun embracing JavaScript?

[image]

As a followup to my post about Java yesterday, I wanted to throw out some quick observations about JavaScript and where I think it might be able to help Sun revive the interest in Java as a cutting edge platform. I say "observations" because I haven't really come up with a hard-and-fast conclusion about what all this stuff means in the big picture, but I think the following points to something pretty interesting:

* Sun actually owns the trademark to the name JavaScript. Despite the fact that it has several other names like ActionScript, ECMAScript, JScript, etc. just about everyone still calls it JavaScript. It makes sense for Sun to really embrace this.

* JavaScript is not only the most popular programming language in the world, with some insane percentage of web content written in it, but it's also one of the hottest languages right now because of the interest in AJAX.

* Despite the fact that JavaScript is so popular, it's not used in web servers really at all. A long time ago there was Netscape's servers that were popular and used LiveScript or a variation, but now I think you'd be hard pressed to find a lot of sites using it, preferring instead PHP, Ruby, or Java servlets. I think this is going to change *really* soon. There's already some movement in this area - I ran across a mod_javascript out there a while ago and the news that someone at Google had written a Rails clone using JavaScript was met with tons of positive reception and eagerness to get at the code. I think there's a lot of pent up demand here which is going to cause something to happen pretty soon.

* JavaScript is not used as a general scripting language either. I have never seen any .js scripts with a !#/usr/bin/javascript in the header doing stuff like managing files or doing background tasks, etc. Also, I can write plugins for much of Gnome using Python, but not JavaScript. On the other hand, many Microsoft scripts using the Windows Scripting Engine are actually written in JScript, which is cool - but it needs to have a lot more support in the Unix world. Sun could really help here by making libraries, etc.

* Apache's Rhino is actually a great implementation of JavaScript. Unlike something like Jython, which is good, but several versions behind CPython, Rhino is actively updated and maintained and works seamlessly with all the Java libraries as well. It makes it a no brainer to integrate into Java projects already, and is being used for some *really* cool demos using JQuery.

* There's a lot of work being done by the Mozilla foundation and Adobe to integrate a killer JavaScript interpreter into both Flash and Firefox using Adobe's Tamarin engine. This is great - and could lead to JavaScript being used in more general purpose areas as well if the interpreter speed is good. Also, isn't Adobe's AIR stuff using it extensively?

So where Java seems to be stuck in corporate bloated hell with more deserters every day, JavaScript is actually super popular and on the cutting edge of innovation. And considering that it's completely unrealistic to expect that Java itself will get a total overhaul, maybe Sun would be well served to embrace JavaScript as the official next-generation language for their JVM - starting with a set of libraries and tools that would let it take the place of where PHP, Python, Ruby and the rest are being used now.

This is an important point I want to make - I'm not talking about making the JVM more scripting compatible and embracing a bunch of various scripting languages from Ruby to Groovy, I'm talking about making JavaScript the pre-eminent scripting language for the Java platform. [Update 8/26: Ben Meadowcroft pointed out that Rhino is already included in Java 6! I knew this, but somehow totally forgot when writing this post! Now the question is, will Sun think of Rhino as just another included library, or really embrace it and start pushing JavaScript as their main scripting language?]

Why? Because I don't think that the multi-language focus of Microsoft's CLR is the right path *at all*. Now, this is completely, 100% my opinion, but I just don't like working with multiple languages at the same time. I much prefer to have one language in my toolbox that I try to use for as much as possible, so that I can avoid time-sapping context changes, re-use code, and become more proficient with each line of code I write whether its on the desktop, in the browser or on the server. Also, when trying to maintain the code, or work together with others, having one language is orders of magnitude more easy than trying to support a heterogeneous computing environment. I honestly think most developers are like this, but I could be wrong. There are definitely some people out there that love to tinker with as many languages as they can, but I have to believe this is the exception rather than the rule.

So rather than an overhaul with Java, Sun should jump on board the JavaScript train and help push it to even greater heights. (Owning the trademark here will help them jump in front of the queue in many ways, for good or for bad). Imagine how nice it would be to write your server-side scripts and your browser scripts all using the same language and libraries, with the knowledge that it'd work well and be portable to many different platforms? It really fits well with the original vision of Java, doesn't it? And it would make the ticker symbol JAVA all that more relevant again.

Just my thoughts... please feel free to tell me something I might have missed, as I'm definitely not a JavaScript expert by any stretch.

-Russ

Update 8/26: I got a few emails pointing out some server-side JavaScript projects. Tim Bray pointed out Sun's new Project Phobos, and Chris Zumbrunn pointed out the more mature Helma. Very nice, and I'm sure there might be others out there as well, but my point is that neither is gaining or has gained much of a following compared to something like PHP or even regular Java, and everything pales in comparison to the use of JavaScript on the browser.

< Previous         Next >