Groovy + ColdFusion = Happy
Posted by Joe Rinehart at 10:46 AM
10 comments - Categories:
Joe Drinks Java
Over the past month or so, I've become less and less enchanted with using ColdFusion Components to model my applications. They're verbose, and they don't support many constructs I've gotten used to in Actionscript 3.
I've started looking at Groovy, a dynamic language that compiles to the JVM, as an alternative. In theory, results in true Java classes that ColdFusion can use like any other Java class, but is also a truly dynamic language.
I was pleased to find that it simply works: creating a Java project in Eclipse, adding a Groovy class to it, and exporting a .jar into WEB-INF/lib makes the compiled Java version of the Groovy class available upon restarting ColdFusion, just like writing Java. Woot!
Here's the thing, though: you still have this code -> compile -> restart ColdFusion bit to deal with.
I've almost fixed that - I've got a GroovyLoader CFC here that wraps GroovyClassLoader, allowing dynamic compilation of Groovy classes into a running instance of ColdFusion. I'm going to clean it up and test it some on my flight (boarding now!), and hopefully post it later this week...
Allen wrote on 05/06/08 11:19 AM
Nice. I've peaked at Groovy and Grails a bit recently, too.So what exactly is accomplished by this? Essentially a nicer way of writing CFCs? Why keep using the ColdFusion at all? Works as a better glue on the front end?