I’ve been a big fan of scripting languages for a long time. Back in ‘96 it was TCL, and then Python in ‘01, with judicious bits of bash thrown in when working on some antiquated AIX box without modern tools. (mumble, grumble, back when I was a boy … and we liked i!) But anyway.
I’ve always been drawn to the shortened cycle of write-run, as opposed to the write-compile-run cycle with “real” languages such as C and Java, and the even more dreaded write-compile-deploy-wait-wait-wait-run cycle encountered with J2EE applications. Yeah, sometimes you can get away with doing a hot-deploy of freshly-compiled .class files into an existing deployed application, but that still leaves the compile part.
Another thing I’ve come to appreciate with scripting languages on the Java platform is the ability to learn a new API by playing with it real-time. Once you’ve sussed out a tricky bit of shell script just by interacting with a bash shell with readline, it’s really hard to go back to doing things the old fashioned way.
Enter BeanShell. For a better part of the last year or so (since I added Java to my repertoire) I’ve been using BeanShell to do all of those things. And a few months ago when I discovered java-readline and figured out how to make it work with OS X? well, I thought I’d died and gone to heaven (in a figurative, pathetic, and geeky kind of way). Since then, I’ve broadened my horizons by coding up a servlet and a portlet that executes bsh scripts instead of having the logic hard-coded into the .class files, and also a portlet that evaluates commands submitted in a textarea as part of the current request. I’ve saved hours upon hours of development time and
write-compile-deploy-wait-wait-wait-run cycles trying to figure out how to use one of IBM’s less-documented WebSphere Portal APIs.
One of these days I’ll get around to publishing the source to those… “But what about Groovy, Jython, and all the others?” I hear you ask? Great tools, every last one of ‘em, and each with some very cool features. But right now I prefer the Java syntax. If work my way up to a complicated block of code in a BeanShell session, it’s nice to know I can cut’n’paste into my Emacs window and have working code.
Now, for that java-readline summary…