Dynamic Languages on JavaDynamic Languages on Java
<div>This past week, I had a chance to speak with Frank Wierzbicki, and Ted Leung, both with Sun, about dynamic languages and their integration with Java. If you look at Java as a platform, with the virtual machine as the foundation and the supported libraries as its walls, it's the actual programming languages supported that make up the roof. Inside ...
May 4, 2008
This past week, I had a chance to speak with Frank Wierzbicki, and Ted Leung, both with Sun, about dynamic languages and their integration with Java. If you look at Java as a platform, with the virtual machine as the foundation and the supported libraries as its walls, it's the actual programming languages supported that make up the roof. Inside are programmers that are able to use not only the Java language , but also Ruby and Python (among others in a growing list). Specifically, Frank is a Staff Engineer at Sun, focusing mainly on Python/Jython; Ted is a Principal Engineer working on dynamic language support in the JVM in general, as well as tools support.
Frank is a very active committer to the Jython project, which is an implementation of Python written completely in Java, and running within the JVM on any platform that supports Java (see www.jython.org). There are two unique features of Jython compared with the C implementation of the Python runtime:
1 - A single Java implementation (and body of code) runs on all of the platforms that Java runs. This eliminates the need to maintain code-bases per OS/platform.
2 - Python code running on the JVM can call into Java code and the multitude of Java libraries and frameworks available.
Prior to working at Sun, Frank dedicated his nights and weekends to Jython. Now that he's with Sun, he gets to work days, nights, and weekends on Jython, which he's actually very excited about! In fact, Frank is working hard to help Jython catch up to the C implementation of the Python runtime; currently Jython supports Python v2.2/2.3 features, while Python is well into v2.5. Since most Python code out there works with v2.3, this isn't too much of an issue. However, given that he has more time to work on the project now, he sees this gap quickly shrinking.
I asked Frank about the top-three exciting projects he's working on at Sun, and he responded with this list (not necessarily in order):
-The Django project (djangoproject.com) - This is roughly a Rails equivalent for the Python community
-Turbogears (turbogears.org) - He's excited about getting this web framework to work on Jython.
-Glassfish - Integrating Python applications with Java EE. Basically, you can WAR up a Django/Jython app, use JDBC for DB access, and access the Servlet API (also see Python API Wsgi - wsgi.org/wsgi) all from your Python code.
Tedd is working with Jython as well, but he's also concentrating on NetBeans support, and looking to make Solaris the most desired home for Python applications. For instance, with Solaris DTrace integration, Python developers will have more power than before to truly understand their applications' behavior all the way through to the hardware layer. The level of debugging that DTrace supports allows developers on Solaris to debug and tune an application to levels not possible on other platforms.
Tedd's focus goes beyond Jython, however, and includes JRuby integration as well. Sun has been putting a lot of work into making JRuby the ideal runtime environment for Ruby applications. For instance, Tedd claims that JRuby can run Ruby applications faster than C Ruby version 1.8. This is due in large part to the focus Sun has put on JRuby/JVM integration.
Why should Java developers care?
As with most dynamic languages, Ruby and Python shine most for applications that change often. In general, It takes less code to accomplish many common web application tasks when compared with Java. Additionally, languages like Python put readability ahead of other features, and tend to be more modular; it's easy to read and understand new code. As a result, all of these advantages amount to increased productivity. For instance, closures for Java is a current debate; in Ruby and Python, this is in there already.
For those concerned with the performance of an application written in a dynamic language, such as PHP, Python, and Ruby, on top of the JVM, you should know these facts:
-The original HotSpot developers were working on Smalltalk when they developed the Just-in-time (JIT) compiler for Java. JIT compilation compiles Java bytecode further into machine instructions (for the platform it's executed on) the first time a .class file is used.
-With Jython, code gets compiled to bytecode, and is JIT compiled from there.
However, HotSpot can still be enhanced to further improve the performance of these higher level languages. Some of the work that Charles Nutter, also from Sun, has recently done has shown that support for dynamic features is already in the JVM and can be better used in the future with little effort. John Rose is working on something called "The DaVinci Machine" to extend Java performance to dynamic languages that run on top of it. Google the phrase DaVinci Machine or Multi-language VM for more information.
Several years ago, Sun as a company was really pushing Java as the only language needed; but this has changed. Today Sun believes that whatever language you want to work in, you should be able to use it. They're interested in truly finding ways to help developers, especially in the Python, Ruby, and now PHP communities. Overall, Sun is very interested in working with the communities to help these projects grow.
About the Author(s)
You May Also Like