Mark Ramm-Christensen posed some questions about using the JVM as a platform for dynamic languages. Many people do, in fact, use dynamic languages on the JVM (Groovy, Beanshell, Rhino, Jython, JRuby are some big ones… and don’t forget Scala, Nice and other “non-dynamic” languages that target the JVM). But Java the platform has not gotten widespread or serious attention until recently (witness the recent resurgence of Jython, the rise of JRuby and the coming of the Da Vinci Machine).
Mark cites a blog post by Martin Fowler (Groovy or JRuby), which also talks about the rise of new languages on the JVM:
Until recently the Java cry was One VM and OneLanguage. (As opposed to the CLR which started with the cry of one VM and many languages – providing they’re C# or VB.) This seems to be changing as people realize the limitations of Java and begin to seek out different capabilities.
While leading TurboGears, there were definitely quite a few people that I encountered who migrated to TurboGears on CPython because they were unhappy with Java. Python had a great year in 2007 and is continuing to grow well in 2008.
But, all of that growth in Python and Ruby is hardly making a dent in terms of the number of people programming in Java. Why is that?
My theory is that there are two main reasons:
- Java people like static typing, either consciously or unconsciously
- Java people like IDEs
I’m leaving out a third reason which is probably the most likely: inertia. For the moment, I’m going to assume that people aren’t sticking with Java because that’s what they’re used to or all they know.
I think that some people believe that static typing provides sufficient automated checks for their software. I can’t deny that static typing will catch typos right away and helps to ensure that some typos don’t make it through if you’ve got less than 100% test coverage. In reality, though, typos are a lot less important than errors in logic or function, which is what you try to catch with unit tests.1
Oliver Steele made an interesting distinction between being language oriented and being tool oriented. As he points out there, a language would ideally appeal to both types of programmers and will eventually do so if it matures to the point where it gets good tool support.
So maybe Java users are in a spot where they’d like to use a different language to gain the extra mental bandwidth you get through cleaner, more concise code, but they also want their static typing and IDEs. Today, Scala is not a bad choice, but the tool support is still a work-in-progress and some of Scala’s syntax might be more of a leap than many Java programmers want to make.
My guess is that people will start moving away from Java (the language) in larger numbers once a new language choice appears that:
- Has static typing
- Has good IDE support
- Allows them to use their existing code
Scala has a shot, but I expect ES4 to come on fast once the Rhino implementation for the JVM arrives.
1. In a recent interview, Donald Knuth said he doesn’t like unit tests. Note his alternative, though: literate programming. Test driven development is often viewed as a design technique and not a testing technique, and I think literate programming could be viewed as a design technique as well. Both test driven development and literate programming offer advantages over trusting that static type checks in your compiler will keep you from harm’s way.
2. Smalltalk programmers can legitimately claim that you don’t need static typing to make powerful IDEs. Smalltlak provides its powerful capabilities by integrating the development environment with the runtime environment. This gives Smalltalk the ability to perform completion and refactorings based on the objects in the running system, rather than what the programmer has explicitly stated in source code form. It’s a powerful model, to be sure, but it’s a big leap from the “source code in files” models that people are used to.
Though Smalltalk has been around for decades and has failed to become mainstream, many good ideas from Smalltalk have made it into other systems and I wouldn’t rule out a dynamic IDE+runtime becoming popular in the future.