Ask HN: Best partner language for Java -- Python, Ruby, or X?

9 points by jacobscott ↗ HN
In August, globalrev wondered what Ruby has that Python doesn't (http://news.ycombinator.com/item?id=283639). I have a related question.

In my day job I am a Java engineer working on enterprise software (I know, I know). I'm considering taking the time to gain expertise in another language that is strong where Java is weak (I currently stumble around in python with decent results).

No offense to language people, but what I care least about is obscure edge cases. I have no pressing plans to do class metaprograming or crazy language-hack magic in general. I do appreciate elegance and simplicity in a language.

I definitely want something stable, widely deployed, with a rich set of functionality/libraries -- thus my initial thoughts of python or ruby.

What language would you recommend? Why?

19 comments

[ 6.5 ms ] story [ 159 ms ] thread
Either Python or Ruby is a good bet. I'd personally go with Ruby. I could rack my brain for good, logical reasons, but I'll keep it simple: I've used both and I like it more. Other people prefer Python. I do think that JRuby is a bit further along than Jython, but that's probably not a deal maker.
Every person I know that knows Ruby knows Python while the inverse is not true. Despite liking Ruby, I suggest trying out Python for the larger user base.

That being said, one thing that you may prefer about Ruby is that its both more OO than Python (you do len(array) in Python and not say array.size) and more functional, so it may be more consistent with your knowledge of Java while exposing you to all the joy of functional programming.

While I'm blabbering, I also suggest you consider learning as many weird languages as you can. I think its usually kind of informative. (I suggest running through a tutorial where you build something in that language so you have a feel for where its strong and weak, and then if you feel extra motivated, coding something up in it.)

I can't back up your experience, but it sounds reasonable.

That suggests that Python is more orthogonal to Java than Ruby is (er, before I trigger a deep language discussion, I mean much more generally - in terms of application, libraries, userbase, available documentation, examples, etc) - again, it's not something I have hard analysis on, but something I can probably believe anecdotally...

So if you're looking for a "partner" language, then all that would suggest that Python might be a good option (i.e. less overlap == more complimentary).

... That's some pretty rough logic, but maybe something to start with.

I'm pretty decent at ruby, but only know a little python. :shrug:

The OP should try both for awhile. One striking difference I've found between the two are the communities. There's the python community, the ruby community, and the rails community, and they have vastly different memes and "tenor". One might fit the OP better than another.

(Your first line kind of supports my thesis ;))
The JRuby community rocks. Charlie, Tom, et al are doing an amazing job, and the activity on#jruby on freenode is impressive.

I don't know what it's like for Jython, but bugs get fixed fast in JRuby, and help is always available.

If you're into Rails, deployment on Glassfish using warbler looks to be a snap (I've only tried some trivial examples). The seem seems to be true for any Rack-based Web app (though, again, I'm still short on deep experience, and have not gotten satisfactory results for Ramaze yet).

For desktop apps, I (in my strongly biased opinion) think nothing beats JRuby + Swing + Monkeybars.

Since you've started with Python why not stick with it?

Python and Ruby have way more in common than the good natured ribbing the two communities give each other might suggest. Besides which, Java/Python is a very employable combination.

Once you've gone a bit further with Python why not try some ruby, then lisp/erlang/ocaml etc. etc. etc.

jruby doesn't work very well at the moment. Dog-slow performance on the jvm, buggy. I'd suggest trying out Scala. Eventually jruby will catch up, but supposedly it needs java 1.7 jvm dynamic language support to be effective.
I'd disagree here, although I do like Scala. JRuby is, in general, not "dog slow", especially not compared to MRI ruby.
when I benchmarked rails on jruby on my machine I managed to get half the number of concurrent requests that I could get with mod_rails + apache, and the .war file took several minutes too boot sometimes, and sometimes it didn't boot at all. (java 1.5 + tomcat 6, and a rails app that we previously been running on mod_rails). I don't call that production ready. When MRI is slow, why go with something even slower? Is performance better with java 1.6 and glassfish? probably, but I haven't tried that yet so I don't know.
from what I've heard performance is much better in 1.6e
"jruby doesn't work very well at the moment. Dog-slow performance on the jvm, buggy. "

Simply untrue.

Go for Ruby. JRuby is actually faster than Ruby, and will improve in future versions of jvm. Calling java classes from jruby is simpler than calling Java from Java. If you're using Eclipse as IDE, I suggest you try out the DLTK Ruby plugin for code completion and debugging. Netbeans IDE is also a good bet.

I've never gotten used to python's use of indentation as syntax. The __magical__ method names with double underscore looks just plain ugly. In my opinion Ruby code looks more clean and simple than python.

take a look at Clojure
I'd second a recommendation for Clojure. If you're already strong with Java then you could consider Clojure a complementary language that gives you lispy constructs and syntax, but is backed by libraries you already know.
Ruby and Python are both great choices like everyone has said. However be warned! It may make you quit your enterprise software job. Once you move to a dynamic language you will become increasingly frustrated with the inadequacies of the Java language. Eventually you'll want to work with Ruby/Python/etc so much that it will make you quit your job....and move on to something, possibly, better. :)
There's Groovy (http://groovy.codehaus.org/). I didn't get a great feeling about it when I tried it a couple years ago, but I really haven't used it much or know enough about it to pass judgement. It sells itself as "builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby and Smalltalk", so it seemed pertinent to this thread.
i first learned python to use google app engine. if u think u might be dabbling with mini web apps, try python so u can drop into google app engine. just fyi that gae is still immature but barrier to entry is the lowest that i've seen. curious on other's opinions about this.
I would recommend picking up Django instead (GAE isn't really Django, just bits and mangled pieces of it IMO). 1.0 was recently released and its better than ever. Plus you can host your Django application anywhere :)