views:

308

answers:

8

So I've been programming in PHP and Python (and recently Ruby), and I was just wondering: should I just Java-based languages (or the Java implementations of languages) from now on, to take advantage of the immense collection of Java libraries? Would that really benefit me as much as I think it would, or am I crazy?

For example, let's say I'm learning functional programming. Should I go with a general language like, say, Lisp, or a Java-based one such as Clojure/Scala? A better example: would it benefit me to learn Groovy and Grails instead of, say, Ruby and Rails?

I know this is kind of a vague and somewhat subjective question, but I'd like to see the ups and downs of learning only the Java implementations of languages.

EDIT: It looks like there was some confusion. I'm asking about whether I should use Java-specific languages and/or Java implementations for the Java libraries. In other words, is it worth learning the Java libraries if I'm not actually going to be coding Java? I apologize for the poor wording, and I've attempted to reword the question.

+1  A: 

I don't know about jRuby. But I don't think there is such thing as learning an implementation of a language. Jython and cpython are two implementations to the same language. There might be some little differences in very low level details. But I don't think it maters if you start with one or the other.

Look at it this way: If you learn how to drive, it doesn't mater if you end up driving a fuel or electric powered car

Nadia Alramli
The question is related to the fact that if you use a Java-based implementation, you may gain access to the full JDK libraries which would not be available to a C (or other) implementation of the same language.
Eddie
+1  A: 

In short "It Doesn't Matter". JRuby, Ruby is still ruby. Python,Jython, cPython is still python. Get your language fundamentals right. From my understanding if you are good at Python you will have no problems doing JYthon, new libraries are born in almost all languages everyday.

Perpetualcoder
I'm sorry but I have to say that your answer seems a bit derogatory. I'm not sure if you meant it that way.
Luke Schafer
+1 from me. I didn't read it as a slam. Just my opinion.
duffymo
A little harsh, but I reworded the question.
musicfreak
+5  A: 

it's a give-and-take sort of thing. For example, using pure ruby is easier as it's flat interpreted code-files and doesn't require building anything or firing up the VM. On the other hand, there's way more in the way of java libraries than ruby gems, so you would gain a lot of power and flexibility. If you don't particularly need java components, then I would say no.

It's always a good idea to learn new languages, however, so I would suggest learning java anyway. That way, if you later have the need to use JRuby, you know all the pieces of the puzzle

Luke Schafer
+1, this is exactly the answer I needed. Thanks. :)
musicfreak
A: 

Use the most appropriate tool for your particular needs. Just because a language is implemented in Java doesn't necessarily mean that you gain access to the whole JDK libraries. I'd check out documentation to see if the implementation exposes access to the JDK libraries (or blocks access to the JDK libraries).

Eddie
+1  A: 

I thought the point was that those languages were ported to compile to Java byte code. Doesn't that mean that source code still follows the accepted grammar of the language it's written for? So if you're writing Clojure, it's Scheme that's compiled to Java byte code that happens to run on the JVM. If you use Rhino to run Javascript on the JVM, you're still writing Javascript.

If that's correct, I'll second the comment from comment from Perpetualcoder: The fact that your language is compiled to run on a JVM doesn't change how you write the source code. It all depends on how faithfully the compiler supports the language grammar.

duffymo
In the particular case of Clojure, it is actually much more than just Scheme for the JVM. It's got new syntax and new language concepts.
Greg Hewgill
Thank you Greg, I didn't know that. Thanks for the correction.
duffymo
Totally Agree +1
Perpetualcoder
A: 

So the question is:

If I'm using JRuby, Jython and Clojure is it worth to learn the java libraries?

My subjective answer is:

Yes, it is worth. You never know when something is available in other language and may be useful.

If the question is:

Should I learn them?

My asnwer is NO, you are not going to use them anyway, you already know that you need to work ( Python, Ruby, Lisp, PHP etc ) probably if you don't have direct need on the tool you won't learn it very well.

Is it worth? Yes, should you learn it? I don't think so.

:)

OscarRyz
+1  A: 

I suggest you should learn the libraries as you need them. Not only java ones, but in all languages. This suggestions is easily extendable to frameworks.

The only point that is midly relevant to the actual context of languages that run on jvm: java has a library/framework for almost every single task you think. Most of them open source as well. This means that if you learn one, you can use it in java, and all other languages on top of it.

With jsr 233, you can also do it the other way around: libraries in other languages can be used in java, and feed back yet again to any other language on top of jvm (beware of heavy reflective use and native code though).

Daniel Ribeiro
+1  A: 

Learn Java, even though you may not use it, for the libraries, not the other way around. Look at some of the Java libraries - iText, Lucene, and many, many others that have been ported to other languages.

Sooner or later, you will run across a library or a class in Java and wish you had access to it in your favorite language. Or wish you had a better understanding of how it worked.

Even if you never translate a thing from libraries or Java code, the documentation for these ported libraries naturally tends to be heavy with examples in Java, and their design and function has been influenced by the way Java works. You will be missing things if you have no understanding of Java.

And, sooner or later, you'll end up writing code in Java (and in C#, C, C++, etc) because it happens to be the right tool for what you want to do. If you have at least a passing familiarity with it, you'll know when the right time for that tool has come.

R Ubben