6

I have some batch data-manipulation scripts which support a small business website.

The scripts are a "rat's nest" of Perl, Java, and Stored Procedures, which run on a scheduled basis to update data based on various sources and algorithms.

I want to get rid of the Perl so that I can at least take advantage of transaction management by containing the entire process in a JVM-managed database connection from start to finish.

Which of the various Java dynamic/scripting language should I leverage which will meet the following criteria:

  • Straightfoward to migrate Perl code by providing similar expressive power, I/O, regex's, etc.
  • Good IDE support, including code completion and debugging preferably in Eclipse
  • Easy to install. Preferably the entire scripting engine should be in a single jar file.
  • Not an orphaned technology. I want to pick something that will still be around in 5 years.
  • Of course - clean integration with the rest of the Java code that I already have.

I hope my criteria are clear enough that this does not get tagged as a subjective question.

For me this is definitely a programming question. I see all those languages as just "useful java libraries".

Thanks!

Alex R
  • 11,364
  • 15
  • 100
  • 180

3 Answers3

2

I vote Jython since it can interact with existing Java code and it's got a strong support base. Not mention its Python which is easy to learn and use. Eclipse has pretty good support for syntax highlighting, debugging, and auto-complete. Finally the install is super easy since it's a stand alone folder (no real "install").

I'll admit bias since I have used the other tools you mentioned much less than I have Jython but I have not needed to since Jython has fit the needs so well.

Andrew White
  • 52,720
  • 19
  • 113
  • 137
  • 1
    Couldn't it be argued that JDK 1.8 will have features (like projects Coin, Lambda, and Jigsaw) that might cause Jython to be eventually abandoned? – djangofan Jan 12 '12 at 21:15
  • @djangofan: not at all, they are actively making the JVM more appealing to languages like Python. Java will never by a Python or Ruby. – Andrew White Jan 12 '12 at 21:34
2

To be fair, Jython, JRuby, Groovy would all be good choices. They all have the decent IDE support, and the syntax is as expressive, and more succinct than Perl. (Python and Ruby both owe a debt to Perl in their conception, so porting from Perl isn't too much of a headache)

Of course, Beanshell and Javascript (in the form of Rhino) will be adequate too, although I'd say that both their syntaxes are less expressive.

Judging on current usage trends, I'd say Jython and then JRuby would probably be the two with the most general support / longevity, in relation to the others.

Really the choice comes down to your level with each of these languages, but of all of them I'd suggest you use Jython, but if your more comfortable with Ruby, JRuby.

ocodo
  • 29,401
  • 18
  • 105
  • 117
  • 1
    are there any references illustrating the "more succinct than Perl" thesis? I'm not familiar enough with either of those 2 to judge, so I'm hoping there would be some sample code illustrating the succinctness comparison of equivalent Ruby or Python vs. Perl code. BTW, good point re: pick whichever one you're most familiar with – DVK Dec 11 '10 at 06:15
  • @DVK - regarding Perl vs Python/Ruby the main point is the latter both support OO style methods (of course Moose provides Perl with OO support too) - they also have far nicer sub/function definition than Perl, I dislike Perl's sub syntax and argument support. – ocodo Dec 11 '10 at 09:48
  • 2
    the only differences are braces (which don't add or remove from conciseness) and named parameters instead of a generic Perl's `@_` parameter list which can be expanded into named parameters in 1 line. I'm not sure I agree that it makes those 2 "more succint than Perl", especially in cases where you need more complicated parameter handling than passing 3 scalars (I'd love to see how Ruby/Python handle the task of taking a parameter list, appending contents of another list and passing that to another function. Perl is as easy as `sub f1 () { my @append=(1,2,3); f2(@_, @append); };` – DVK Dec 11 '10 at 15:14
  • When it comes down to it, language comparisons between perl, python and ruby are purely idiomatic, personally, I find Python and Ruby syntax cleaner and more readable than Perl, perhaps concise isn't quite the correct word (or more specifically, "more concise than perl" isn't right.) Even so, in comparison to the other options you have, Jython is probably the most concise. – ocodo Dec 11 '10 at 22:21
0

I should say that that several benchmarks indicate that Groovy is wins in speed, compared to Jython and BeanShell. The test was performed using DMelt (http://jwork.org/dmelt) framework where you can jump from one language to another, calling same Java libraries.

Steve
  • 1