Diving into java scripting frameworks

As I wrote sunday, I experimented with beanshell and it worked pretty well und faster than I anticipated. Nevertheless I heard about some other scripting frameworks (and their integration in java 1.6) which motivated me to investigate a bit more in this direction. Apparently Mozilla’s Rhino is a very powerful yet fast framework that provides javascript aka ECMAscript. Performance benchmarks by Pankaj Kumar in his article BeanShell, Rhino and Java — Performance Comparison show that my choice of beanshell as a scripting framework might not have been that best – performance wise. I’ll definately check out Rhino for use in my application.

Another interesting framework I came across when looking into scripting with java is the Apache Jakarta Bean Scripting Framework (BSF) which provides a framework to create JSP pages in different scripting languages. To achieve this it offers a uniform interface which wraps several scripting languages like javascript, python, tcl and many more.

A trip to java

Once again a long time has passed where I couldn’t find the time or motivation to write a post. I was mainly occupied with the specification of a java application which gave me the opportunity to get to know Sparx System’s Enterprise Architect. I only used the common uml diagram types and the code generation features for this project and they work pretty well. I’d love to make use of the more advanced features though and look into the whole MDA approach a bit more. There is a fundamental difference in just drawing some class diagrams and really developing model driven from the ground up. Projects like AndroMDA to generate complete applications look promising and certainly could reduce the expenses for software development but I doubt I’ll find time to check it out properly any time soon. As for the modelling language I don’t think everything should be done with UML though – the approach to model every aspect in UML and using stereotypes to define “what it means” makes the modeling too confusing and complex imho. Some interesting views on MDA and Software Factories can be found in the podcast MDA vs. Software Factories and some older episodes.

At the moment I’m working on a prototype for another java application and got used to the new java 1.5 features like generics and the new for each loops. The generics are definately the way to go for typesafe collections and I’ll try to use them from here on out. I found the wildcard <? extends> and some other constructions confusing at first but I do understand that there are several restrictions (german link) when using generics. Someone should publish some design patterns for typical cases that require generics.

For that project I also experimented with BeanShell which is basically a java scripting interpreter. I’ll probably use it for custom formulas which are evaluated dynamically within the java application. Easy to use and powerful.

The next component I’ll look into is EJB3 persistence using Hibernate. I have worked with the hibernate tools and reverse enginered some database tables but since I already have the POJO classes and don’t want to create all the old hibernate xml mapping files I might as well check out how to create EJB3 persistence by using annotations. More on that soon.