HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML

Pat Niemeyer Creator of BeanShell

R. Hightower: What features do you plan for BeanShell?

P. Niemeyer: Well, there's a brief "wishlist" on the Web site at www.beanshell.org/wishlist.html. Some features that will almost certainly be in the next release are more dynamic class loading and class reloading, taking advantage of the API that allows introspection of private and field methods, better error reporting and a more complete test suite.

I also have submissions from people right now that add regular expression support on a par with Perl. I've concocted a way to add this without deviating too much from standard Java syntax. That's always been a goal, to maintain as much real Java syntax as possible and simply extend/loosen it.

I think there's a need for a language that scales semantically between scripting and rigorous, static typing. I think that loose Java is "the natural scripting language" for Java. It requires almost no learning curve.

One feature that bsh got in the latest version takes advantage of a new reflection capability in JDK1.3 - dynamic proxy creation. This allows bsh to emulate any type of interface. You've always been able to script event listeners, etc., in bsh; however, the types were limited to the known types in AWT and Swing. Now, with 1.3, you can script any kind of interface.

In the future I'd like to extend the capability to be able to generate arbitrary types, e.g., extend existing types as subclasses or script abstract base classes. This may sound more arcane, but it's important for one reason. It would allow the bsh syntax to be extended to cover class definitions as well. Right now bsh only understands statements and expressions as well as its own extended method closures (as in Perl or JavaScript, methods that return "this" and act like objects). It would be nice if bsh could interpret 100% of the Java syntax including classes.

I'd also like to be able to have bsh spew out compilable code someday (not that bsh isn't reasonably fast. It's really just limited by the speed of the reflection API right now). But it would make a lot of people happy if they could flip a switch and turn their bsh script into a compilable Java file.

I also think bsh should provide better support for serving as a JavaBean inside various IDEs, to wire together sophisticated connections.

RH: I see that you've made BeanShell opensource. How many developers are working to extend BeanShell features?

PN: There are a couple of hundred people on the developer's list. I'm currently in the process of moving development over from the beanshell.org ISP to sourceforge.net (an opensource facility with lots of neat features like public CVS, etc.).

I think I'll do a maintenance release for bug fixes and then start working on a 2.0 with the new features.

By the way, there'll be a brief section on BeanShell in the third edition of my book Exploring Java (O'Reilly & Associates). The book is to be retitled Learning Java. I mention this because it will probably prompt me to get back to work on the next release...we've been stuck at 1.0 for a long time.

RH: Do you know of any commercial products that use BeanShell as their scripting language?

PN: I started maintaining a list but it's incomplete. First, everyone should know that BeanShell is distributed with Emacs as part of Paul Kinnucan's JDE to serve as a Java interpreter. I believe he also uses it internally. Various other IDEs are providing plug-ins for it: Sun's NetBeans has been interested. They did a poll recently and JPython and BeanShell were the top choices. I believe the ElixirIDE (http://elixirtech.com/ElixirIDE/) has a plug-in now. And someone just wrote one for JBuilder (www.multimania.com/bjb/index.en.html). CERN, the physics people, use it in a sophisticated visualization app. Two years ago Corel (the WordPerfect people) contributed a lot of bug fixes and help but then their Java efforts sort of dried up. I am aware of some Jigsaw integration and the JOS (www.jos.org) people are considering it for their shell language. I am probably forgetting some important ones. Tens of thousands of people have downloaded the code and I have perhaps a thousand license forms (it's just a request - the code is LGPL, of course). I hope to put a better list together when I update the Web site.

RH: What special features set BeanShell apart from other scripting languages?

PN: Other interesting things to mention are that BeanShell can be easily embedded in Java or, vice versa, bsh scripts can call any Java app or API seamlessly. By seamlessly I mean that live Java objects can be passed into and returned from scripts. Bsh also has a "server mode" which allows you to run bsh inside a running app and then open a console from your Web browser (or telnet) into the application and poke around like a debugger. (This feature is shaky in some releases.)


All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.