Ok, so I know the world is in the grip of Groovy madness right now, but for the rules engine of our little spam filter app I’m leaning towards BeanShell.

The big sell for me is the lightweight story - less than 200k for the whole thing - including Swing editor - with no other dependencies. Plus I don’t really need to learn any new syntax! It’s groovy in it’s own way ;-)

The other thing I really like is that it’s very straightforward to extend the language with your own commands. Need a stripHtml command for a spam rule? Piece of cake. Define a stripHtml.bsh, fill it with:

`

import org.apache.regexp.RE;

stripHtml( String textToStrip ) {

RE r = new RE("<[^>]+>");

String replaced = r.subst(textToStrip, "", RE.REPLACE_ALL);

return replaced;

}

`

Then just use a stripHtml(); in your scripts wherever you like (with an importCommands("/path/to/commands"); somewhere in your setup). Good to go. Simple. Straightforward. Small. Just works.

I’m doing a combo talk with Matt next month at our Canberra Java User Group which is going to be “Java Scripting - Groovy and Beanshell” - he’s doing the Groovy bit, I’m doing the Beanshell bit. Should be a fun time. If you’re in town, drop by!