I was on the phone this morning to the Italian part of Switzerland, talking to Samuele Pedroni, currently chief priest in the Jython temple. I think Jython is real important, which means that I think Samuele is important. But only if you care about Java.

Dynamic Languages · I tend not to be religious about technology; I’ve been wrong enough times to be unsurprised when I run into a good argument pointing a direction I wasn’t thinking of going. But sometimes I’m sure of something, and right now I’m 100% take-it-to-the-bank bet-my-career sure of this: dynamic languages (what we used to call “scripting languages”) are already playing a large role in Enterprise Software Development; and their role is going to be growing in size, at least for the next little while. Jython represents a chance to have that growth happen inside the Java technology environment, rather than outside.

Why Dynamic? · I wrote about this last May, and while I stand by every word, you might do just as well to visit the three outstanding pieces that I referenced: by Paul Graham, Bruce Eckel, and Robert C. Martin. If I had to cram it into one sentence: it’s faster to write software in dynamic languages, and the (real) benefits you get from an anally type-sensitive compiler can be had more cheaply with modern testing disciplines.

But the theory doesn’t matter, because the action is in the practice, and a whole lot of programmers out there have noticed that, in practice, they can get the job done quicker in Perl or Python or Ruby or whatever, and it runs just as fast and breaks less and they get promotions and raises. So whether or not you like dynamic languages, you better warm up to ’em because they’re not going away any time soon.

If you disagree, you can stop reading right here because dynamic languages in general and Python in particular and Jython in particular particular are a distracting waste of time. Of course, you’d be completely wrong.

Python · In the land of dynamic languages, probably Perl is the most broadly used, Python the best-regarded. That is to say, even people like myself who are pretty solidly Perl-addicted recognize that there are some really terrifically cool things about Python’s syntax and object model and that we’d do well to learn it if only we had time. I’d say that a large plurality (if not a majority) of dynamic-language savants would probably say that Python is the best of the (rather good) options in this space.

Jython · What happened was, back in 1997 Jim Hugunin decided that he wanted to combine some numerical processing in Java with some flexible application scripting in Python, and eventually figured out how to compile Python to Java bytecodes. There are a bunch of references below, and Jython has been through a few maintainers between then and now, and now Samuele’s the guy, working full-time on the next major Jython rev, 2.2.

What’s Jython useful for? Here are three use-cases.

Scriptable Apps · Big complicated applications universally benefit from being scriptable. They also benefit from being in Java. So how do you script your big complex Java app? You could invent your own scripting language, which would be a bad idea. Or, you could script it in Java, which would be like cutting butter with a chainsaw: messy, awkward, and bad for the chainsaw. Or, you could use Jython, which is a mature, well-debugged language with the huge Python community behind it and also has access to all the Java classes and objects in your application... what’s not to like?

Dynamic MVC · Or, suppose you’re building an interactive application. For fast repaint() calls or geometry-crunching, you want to stay in Java. But for the high-level control flow of the app, you’re going to get better productivity in a higher-level dynamic language. Once again, with Jython you get to have your cake and eat it too.

E-Government · Finally, as we speak, Sean McGrath of Propylon is using Jython to architect huge e-government applications. Sometimes, they’ll rebuild performance-critical parts of the app in Java, but sometimes not.

What Should We Do? · First of all, the Java community needs to get over the notion that dynamic languages are in any sense counter to solid modern software-engineering principles. This is happening; along with Jython, we have Groovy, a dynamic language designed from the ground up to be Java friendly. Groovy looks way cool to me; all it lacks, compared to Python, is all those years of refinement and refactoring, and the massive community, and the immense inventory of libraries pre-written do almost everything. Actually, this is less of a disadvantage than you might think, since Groovy by definition can get at any class that Java code can. But then, so can Jython.

The best thing for the Java ecosystem would be for both Jython and Groovy to move along, grow and prosper; there’s plenty of room in here, and there’s the de-facto architecture of the Java JVM and libraries keeping them honest.

But we can do better than just say nice things, we can do tools. Concretely, we at Sun should make sure that there are good NetBeans plug-ins for both Jython and Groovy. I’ll do whatever I can to help that happen.

Samuele’s Letter · After we’d talked on the phone, I asked Samuele to send me a couple of pointers to things we’d talked about; a few minutes later I got the following comprehensive tour of the landscape, which is worth reproducing almost in full:


Jython Homepage: http://www.jython.org/.

Users' mailing list: http://lists.sourceforge.net/lists/listinfo/jython-users. Developers' mailing list: http://lists.sourceforge.net/lists/listinfo/jython-dev.

Jim Hugunin's Jython story: http://hugunin.net/story_of_jython.html.

You can refer to me as the main maintainer and co-author of Jython Essentials: http://www.oreilly.com/catalog/jythoness/.

If you want to give my mail address: pedronis at python.org

I'm a member of the Python Software Foundation: http://www.python.org/psf/.

Another Jython book: Jython for Java Programmers http://www.amazon.com/exec/obidos/ASIN/0735711119/qid%3D1033006782/sr%3D11-1/ref%3Dsr%5F11%5F1/002-1207797-7484845.


User sample:


IBM developerWorks has a bunch of material, some also very recent, on Jython: Charming Jython http://www-106.ibm.com/developerworks/java/library/j-jython.html.

Learn how to write DB2 JDBC tools in Jython http://www-106.ibm.com/developerworks/db2/library/techarticle/dm-0404yang/.

Recent tutorial: http://www-106.ibm.com/developerworks/edu/j-dw-java-jython1-i.html?S_TACT=104AHW02&S_CMP=EDU, http://www-106.ibm.com/developerworks/edu/j-dw-java-jython2-i.html?S_TACT=104AHW02&S_CMP=EDU.


Thanks, Samuele!


author · Dad
colophon · rights
picture of the day
May 03, 2004
· Technology (90 fragments)
· · Dynamic Languages (45 more)

By .

The opinions expressed here
are my own, and no other party
necessarily agrees with them.

A full disclosure of my
professional interests is
on the author page.

I’m on Mastodon!