Wednesday, May 25, 2005

BeanShell Scripting Language

I was greatly impressed by the BeanShell Scripting Language I used for the first time in one of my projects 2 years ago.It was also the only time i used it. I found it quite fascinating that you can write a small mini program in more or less Java like syntax & not bother of compiling & running it in the IDE or on your local JVM. What the BeanShell script did was to give the application an option to run the particular chunk of code at run time on users machine. More or less like JavaScript accept that the BeanShell was actually executed on the application server's JVM. (JavaScript is totally Browser & client machine dependent & is not as powerful as BeanShell)
In our project which was workflow based application we embedded the BeanShell script within a XML tag which was a part of the Workflow XML. Once the server side program parsed the XML & came across the particular BeanShell code, it executed that code like any other normal Java method or class.
Its nice to know that a group of Java enthusiasts have now given the BeanShell the official stamp it deserved.It has been there for some time waiting to be noticed.

BeanShell: The 3rd Official Language of the Java Platform?
Today Patrick Niemeyer with the support of Doug Lea, Apache and Google submitted JSR-274: The BeanShell Scripting Language. In my opinion, this is good news for the Java community.
There are many languages that have been designed to run on the Java virtual machine, most of which you probably have never heard of. Up until a year ago, the Java industry as a whole had a rather myopic view of its platform. The Java Platform had one official language, the Java Programming Language. But in 2004 that changed forever.
In March of 2004 (only 14 months ago), a proposal for an additional official language for the Java Platform, JSR-241: The Groovy Programming Language, was submitted and approved as a JSR ( I blogged about Groovy then and more recently when I recounted some of Groovy’s history).
The approval of Groovy as a JSR marked a rather significant shift in how the industry views the Java Platform. The Java Platform is no longer synomonus with the Java Programming language. This is a concept that I wrote about on the This Is Java blog. The programming language used with Java is the most interchangeable aspect of the platform. You need the JVM and the standard packages in order to create a common platform for development, but the language should be able to change according to the needs and preferences of developers.
The proposal to make BeanShell another official language of the Java Platform is, in my opinion, a great sign that Groovy succeeded in changing the mainstream view of Java from that of a language to a development platform. Just as Microsoft .NET supports multiple languages (i.e. C#, Visual Basic .NET, C++ .NET, IronPython ) so too should the Java Platform.
What is really interesting about this announcement is that BeanShell has been around for a while, so they are starting with a fairly stable code base. In addition, BeanShell is really small so that it can be included in future versions of the J2SE. That’s right, in the future when you download J2SE 6.0 (or whatever) it may come with support for both the Java Programming Language and the BeanShell Scripting Language.
So, what about Groovy? Groovy is on track to become an official language of the Java Platform in its own right. Without the benefit of a deep analysis of BeanShell, I suspect that Groovy is somewhat more sophisticated as a language. But Groovy is also more complex and is certainly larger. I expect that developers will learn BeanShell more easily than Groovy, but that Groovy will be chosen for larger more sophisticated development efforts than BeanShell.
That said, its very possible that BeanShell will grow into a complete dynamic language on par with the ambitions of Groovy and the qualities of Python and Ruby. In either case, it’s really a win-win situation for the Java community. With three languages to choose from, all of which will generate code that runs on the same JVM and can interact with classes written in the other languages, Java developers will have a truly versatile platform.
Microsoft has always seen the advantages of supporting multiple languages and have found that it actually attracts a larger audience to their platform. I believe the same is true for the Java platform. Having multiple officially sanctioned languages ensures that the Java Platform as a whole attracts a larger audience. At one time Sun said that it wanted to grow the Java community from its current 3 million developers to 10 million. This is exactly the strategy needed to help accomplish that.

No comments: