15 points · by oscardelben · 17y ago · 25 comments
I come from a Ruby background mostly, but I deeply appreciate languages like scheme, and even Erlang.
The thing is that both Clojure and Scala assumes that you know Java to get the most out of it. For example in the Scala book from the pragprog, the author says that if you are not experienced with Java, you should complement your study with several Java books.
The fact is that I don't think it's worth for me to learn Java, so I wonder if learning any of these JVM languages is worth it.
At the moment, the ten most popular languages are (according to http://www.tiobe.com/index.php/content/paperinfo/tpci/index.... and whatever metric they use):
1) Java
2) C
3) PHP
4) C++
5) (Visual) Basic
6) C#
7) Python
8) Perl
9) JavaScript
10) Ruby
Given that Java is #1 on that list, I'd find it hard to call some time spent learning it wasted, you're just going to run across it too much, at conferences, in papers, in code that you inherit, in libraries you have to interact with or debug, etc.
Besides, if you know C or C++ it won't take very long to learn the syntax, and the libraries are worth learning because you'll use them in any JVM language anyways. If you don't know C/C++...well, um, add another one to your list, every programmer should have at least a basic understanding of some flavor of C for the same reasons they should know some Java.
If you do start with Java, make sure you actually use Java tools for the job, though, at least once you have the basics down; if you're coding Java in a text editor, even a good one, you're making things far more difficult than they need to be, because it's a language where tools are absolutely crucial if you don't want to drive yourself crazy. Whether it's Eclipse, Netbeans, or IntelliJ, you haven't really learned Java if you haven't learned how to use one of them well.
I agree though, that a cursory knowledge of Java is probably helpful in this day and age.
Presumably the whole point of using a language that runs on the JVM is that you can use libraries written in Java.
Attila Szegedi is also working on a MOP for dynamic languages, which, if integrated by language designers, will make it possible to instantiate classes and call methods from modules written in other languages (much like the DLR, but with a different architecture) ... see here ... http://dynalang.sourceforge.net/
There are times when a Java method demands a specific Java type and JRuby does not automatically convert correctly, but mostly the use of Java libs from JRuby is pretty trivial, and the only time I've had to write Java to wrap anything was when I wanted a nicer API for some 3rd-party crypto libs and adding a few methods to the Java source was easier for me.
I do, however, know C++ well so Java isn't much of a problem. But it's not a difficult language, especially as it's designed to stop people making mistakes. (!)
With that aside, I think it's certainly worthwhile to take the time and get a basic understanding of Java, as well as survey what is available in terms of libraries (both standard and 3rd party libraries). Some of the biggest appeal of these languages comes from the fact that they're able to leverage all this existing Java code.
At this point in time,to make the most of either language and to develop a "real" application you should know Java and not just Java but the tool, library and the infrastructure support of the Java ecosystem that comes with it.
Having said that, if you just want to "learn" the language i.e. the Type System, really grok STM , the API's and how to do something in it - then there can be no better substitute than to start building the libraries,tools etc. that do not exist in Clojure and Scala. Pick up something that you currently can't do in Scala without dropping into Java and build it. Of course this is not an easy undertaking but you will learn lots.
The question is really if it is worth writing your own libraries from scratch as opposed to learning and using the vast amount of (usually commercially-friendly licensed open source) code that is already out there. Most of the time this is a pretty simple choice.