Java with maths, the JVM without Java
December 9, 2009 3:04 AM   Subscribe

I have two (possibly naive) questions about Java that I'm looking for a 10,000 foot view on. First, what are the preferred libraries are for maths and charting? Second, what are the distinguishing points between alternative JVM languages?

The aim: I have a few old programming projects (bioinformatics, data manipulation and visualisation, statistics) that I'm looking to port into the modern age. So, I'm looking towards Java and the JVM, so as to make the code easily portable and ensure its future maintainability, and possibly learn something new and useful for future work.

1. What numerics, stats and graphing libraries would people recommend within Java? In (say) Python, there's just a few obvious leaders that everyone uses (Numpy and matplotlib). For interoperability, support, longevity and a good user community, I'd like to pick the "right" ones within Java. Yet it's unclear from the wide variety available which ones are good and thriving and which are niche projects.

2. The idea of an alternative language running on the JVM is appealing, especially a dynamic language (for development speed, quick scripts, data analysis, being able to use it from a interactive prompt etc.). Coming from Python, Jython is the obvious choice but seems to be a 2nd class citizen - a bit messy, some standard libraries not complete, a bit slow, doesn't seem to have a huge development effort behind it. JRuby? Also a bit slow, and I'm not a huge fan of Ruby's peculiarities. So my eye has been drawn to Groovy and Scala. Scala in particular looks cool, and promises to be fast. Groovy looks easy although again there are possible speed issues. Any opinions or things I should look out for?

Possible useful background details: I've got years of Python and C/C++behind me, and a decent swag of Java and Ruby. Speed of execution is always important, but speed of development is even more important. I'm a great fan of Python's interactive prompt and being able to mess around with code. There's a large swag of bioinformatics libraries within Java that I can use from any JVM language so that shouldn't be a problem. The initial projects will be commandline utilities, but I don't want to be limited to that in the future: desktop apps and web services may raise their head.
posted by outlier to Computers & Internet (8 answers total) 5 users marked this as a favorite
 
Scala isn't a dynamically typed language, it's statically typed and actually has a rather baroque type system. Supposedly it's pretty flexible, though.

I don't know much about Groovy. Another alternative language that's gaining popularity is Clojure which is a LISP/scheme-style language, and Tim Brey calls it "the Best LISP Ever", due to the fact that you get to use all the java libraries out there.

If you want to write quick scripts and an interactive shell, then that's probably a good way to do it. If you can get your head around functional programming, of course.

And of course there's JavaScript, which is kind of like the redheaded stepchild of the PL world, but it's probably the most popular, well known dynamic language in the world (other then maybe Perl?). Since JDK 1.6 The java standard library has actually included a java script engine built right in. That means you should be able to write your main libraries in Java, and then write scripts in JavaScript if you want.

For charting there's JFree Chart
posted by delmoi at 6:14 AM on December 9, 2009


For development scripts and testing, I recommend Groovy or BeanShell. They're great for messing around at an interactive prompt and saving tons of development time. Jython works but unfortunately it doesn't support a lot of Python features that we know and love.

Scala is intended as a replacement for Java-the-language, it's not really great for little scripts. That said, if you like strongly-typed functional languages, it's a very nice alternative. It will take some effort to learn if you're coming from C/C++/Python.

I haven't used Clojure but it sounds good.
posted by miyabo at 7:16 AM on December 9, 2009


I have JFreeChart and it seems to be a good project. I am currently using Groovy for bioinformatics software development and it rocks - definitely give it a go (disclaimer: I am still in the honeymoon period with this language). If you're thinking about webapps I can also recommend Groovy because of the Grails web framework.
posted by primer_dimer at 7:30 AM on December 9, 2009


One more thing; if you're involved in bioinformatics and are interested in speed, then you're also interested in parallel processing. I don't know about the other languages you mention, but you should definitely investigate the concurrency libraries available. I have recently played around with GPars and been very impressed. It is immature but useful and seems to be failry active.
posted by primer_dimer at 7:32 AM on December 9, 2009 [1 favorite]


If you want your code to be around for a while, i'd recommend Scala. Though, it is not dynamically-typed, and as stated above, it may have a learning curve if you don't have any knowledge of functional languages.
posted by mezamashii at 7:58 AM on December 9, 2009


Response by poster: if you're involved in bioinformatics and are interested in speed, then you're also interested in parallel processing.

Bang on the money and something I'm interested in that I didn't mention. Not being able to take advantage of all these multicore machines is aggravating.
posted by outlier at 8:24 AM on December 9, 2009


Scala and Clojure are both designed with concurrency in mind. Java's concurrency support is pretty good and there are a bunch of upgrades for Java 7 as well (like forkjoin)
posted by delmoi at 8:57 AM on December 9, 2009


Not being able to take advantage of all these multicore machines is aggravating.

Definitely take a look at the Tim Bray link delmoi provided above then. His blog posts should give you a decent overview of Clojure.
posted by yerfatma at 9:05 AM on December 9, 2009


« Older Films from the Middle East   |   Food In Paris???? Newer »
This thread is closed to new comments.