This article is more than 1 year old
Phobos – not just Java scripting for servers
The script may be getting better
There is now a gentle but distinct undercurrent of real world acknowledgement going on in the Java camp, where the posturing about purity is being softened by the fact that other programming languages and applications environments not only exist but are probably good at some functions.
Part of that trend can be seen in the hint that Rich Green gave about server-side scripting, just before JavaOne.
And server-side scripting there will probably be, though what the specific applications sweet-spot will be is still an unknown, according to Sun director of web technologies Tim Bray. It is still only a the project stage - Project Phobos - but it looks set to become one more bridge that is being built between Java and other environments. In real terms, this means Microsoft's .NET.
The underlying beauty of such developments for developers is that the specifics of any skill-set they have no longer ties them as individuals to a particular platform, environment, or marketplace. The ways of exploiting it in the "rival camp" are growing - and that can only be thought of as a good thing.
Project Phobos was one of three examples of non-Java languages demonstrated running on the Java Virtual Machine (JVM) at the recent JavaOne conference in San Francisco. One of the others was Project Quercus, from a company called Caucho, well-known for its Resin application server. This is a version of PHP that runs on the JVM and is sufficiently advanced that it can run Wikimedia, the infrastructure for Wikipedia. According to Bray, it actually runs substantially faster than the native version. The other was jRuby, an implementation of Ruby running on the JVM. The actual demo showed Ruby on Rails running on the JVM.
"The third one was Phobos," Bray said. "This is a framework, running on the JVM, that allows you to program in scripting languages. The one that has been done first is JavaScript, running on the JVM on the server side. The demo was of an AJAX applications running a mashup of Reddit and deli.cio.us. The broader message behind this is that it starting to become interesting to run non-Java languages on the Java platform. If you look at the Java platform it is three different things. There is the Java language, secondary the API library, and the third is the JVM. Of those three one, the language, is replaceable."
He readily acknowledged that Sun has, historically, tried to get people to use the Java language for everything, but said over the last couple of years it had been opening up to using non-Java languages on the JVM, matched by a huge upsurge of interest in scripting languages such as PHP and Rails.
"So there are three reasons we can see why non-Java languages are a good idea on the JVM," he said. "One is that there are millions and millions of Java developers and it would be good if they could use the other languages, because the rules and the ways of thinking are good. I think the notion that one programming language is appropriate for the whole universe of problems is just silly.
"The second is that the universe of Java APIs is large, rich and very high quality. Third is, if you look at all the dynamic languages, they typically have pretty lousy implementations of threading and concurrency, it is a weak spot. This is a problem because the servers we and our competitors are shipping are getting wider rather than faster, so something needs to be done if these dynamic languages are to be run well on the new servers. And one thing that can be done is to run them on the JVM, which has excellent implementation of concurrency."
Phobos is part of the Glassfish project and Bray personally sees it as an extremely interesting thought experiment that currently exists to show Java platform capabilities that people did not realise it could perform.
"For example, you can do lightweight scripting, such as opening up a JavaScript page that is doing something in a text editor, edit it and pop it into the application," he suggested. "Some people might think we're mad, but when you consider that the server side language and client side language are the same, it is a good thing."
Information on it can be found here and I look forward to seeing what the community thinks of it.
Bray claimed that JavaScript has started to grow up into a robust and decent language, and there is now the Rhino JavaScript engine which is being included in Mustang, the next Java Standard Edition. He said Sun's objective is to create an ecosystem where it is perfectly OK to utilise non-Java languages and from this "good things" will happen.
"If we can improve the developer experience we will expand the scope for selling computers. It is a new direction. People used to think that if you used the Java platform you had to write in Java. Well, perhaps maybe not," he observed.
And how far towards the "old enemy" does this pragmatism now go? Bray pointed to another Java Project called Semplice. "This is Visual Basic on the JVM."
There a good few "ifs" to be overcome yet, but if it works out, and if it can be extended to encompass Visual Studio, then this should offer some interesting potential, not least because of the vast army of VB developers that exist out there. ®