3

I am currently deciding on an alternative JVM language to port an existing Swing desktop application written in Java 6. Given that JavaFX specifically targets this kind of application, it would seem that my best option is JavaFX Script.

However, what about other kinds of applications and libraries? Would JavaFX Script be the best choice in general for a second JVM language?

Currently, it seems that Scala is the most talked about alternative to the Java language. This month (October 2009), it is at position 34 in the TIOBE index, while JavaFX Script is at position 44, and Clojure, Fan, and Groovy are at positions below 50.

So, what are your impressions? Which language would you invest your time in learning and using (and why), assuming you can freely choose the language for a given project to run in the JVM?

Alex Miller
  • 69,183
  • 25
  • 122
  • 167
Rogério
  • 16,171
  • 2
  • 50
  • 63

3 Answers3

4

My main question would be: why are you porting an existing application? The answer to this question may give you some idea of where you want to go.

Some quick perspectives on the main choices:

  • Scala is in my view, a better Java than Java. If you want a language that takes the best bits of Java buts adds a lot of new innovations and features, then it may well be for you.
  • Clojure is an amazingly well designed language, particularly if you believe in a future of highly complex, concurrent applications. It's also extremely productive - I can probably create more value/hour in Clojure than any other language. However, unless you already know Lisp it will seem very unfamiliar at first. If you are willing to live on the cutting edge to get these benefits, Clojure may well be for you.
  • JavaFX script - has some very nice features for GUI design, and clearly has support of Sun/Oracle. On the other hand, I don't see it having massive traction outside this domain. I'd suggest giving it a trail run to see if it meets you needs.
  • Java - should still be on your list! If the reason you are porting is because the code has become difficult to maintain, then maybe a focused phase of re-factoring while staying on Java can get you the benefits you want. It's possible to write perfectly good GUI applications in Java.
  • Groovy - really nice scripting language on the JVM. Particularly good if you want to embed scripting features within an existing Java/JVM application. Not sure I'd choose it for (re)writing a complete application however.
  • JRuby / Jython - haven't seen these much myself but heard good things. Probably most suitable if you have Ruby / Python skills in the team but also want the benefits of the JVM platform.
mikera
  • 105,238
  • 25
  • 256
  • 415
2

The best alternate language, and the best language overall, IMO, is that which best allows you to write the program in the best model for you.

So, if you are writing a GUI app, then Scala may be the incorrect choice, as you wouldn't be moving away from Swing.

If JavaFX best meets your needs, then use that language.

If you know LISP then Clojure would be a good choice, but, like Scala, not for this problem, it sounds like.

If you don't know lisp and you want/need a functional programming language, then Scala would be the best choice.

Basically, there is no one language that is best in all situations, it helps to know what you want to do, and the strengths/weaknesses of the various options.

James Black
  • 41,583
  • 10
  • 86
  • 166
  • 1
    I agree with everything you said, but I don't really look forward to learning/using half a dozen different languages for the JVM. Also, most of these languages are probably never going to become mainstream... – Rogério Oct 11 '09 at 02:35
  • Just be aware of them. For example, if you don't know lisp, then ignore Clojure. If you don't ever need FP then skip Scala. If Java SE/ME/EE does everything you need, but you are missing one or two features, then just find the language that will help with that and learn that one. – James Black Oct 11 '09 at 02:43
1

Those all sound like good choices. You could add JRuby to the list...

DigitalRoss
  • 143,651
  • 25
  • 248
  • 329
  • Some time ago, Sun appeared to be interested in pushing JRuby. Now, it seems that the focus (and the money) has moved to JavaFX. It would be interesting to know if this really is the case. – Rogério Oct 11 '09 at 02:41
  • Well, the JRuby developer has moved from Sun to Engine Yard. Ruby is obviously doing well and I expect both JRuby and Ruby are here to stay. JRuby does run Rails, you know, and that's the acid test for Ruby functionality. (The *Rails Singularity*.) There are other Ruby projects out there that still can't do that – DigitalRoss Oct 11 '09 at 03:58
  • I do agree that Sun, err, Oracle, is clearly investing in JavaFX. But I also suppose we don't care if Intel supports a given thing that happens to run on their CPU line. Perhaps Sun support for a given JVM compiler isn't such a big deal? I understand your concerns but after citing the Tiobe index you then reject a language in the top 10 in favor of some that got slaughtered, and I say that as a fan of Scala and Clojure. :-) – DigitalRoss Oct 11 '09 at 08:45
  • I am only interested in JVM languages for now, so Ruby (which is a great and successful technology, no doubt) isn't under consideration. I am also aware of JRuby's progress. But still, I would bet on either Scala or JavaFX Script for the future, given the current situation. – Rogério Oct 11 '09 at 14:42