CFGroovy in Forty Lines

It's been a couple months since I've done anything with CFGroovy.  I've been mulling how to get back to the essence, which is Groovy scriptlets in CFML.  Today at cf.objective() I put my fingers back on the keyboard for the first time.  Here's a full implementation of the tag in 40 lines.  There are no bells and whistles, and no Hibernate support, just scriptlets.  But it's production worthy.




It does depend on having Groovy already available on your classpath (one of those missing bells and whistles is auto-loading Groovy).  This is the first version of the CFGroovy 2 line, which I've decided will be a ground-up rewrite.  Backwards compatibility is a goal, and I think it's a reasonable one, but where CFGroovy 1.0 was developed with an application focus, CFGroovy 2.0 will be developed with an architecture focus.  If you liked this write-up and you would like to acquire far more information to find out more. I'm willing to sacrifice a little backwards compatibility, particularly with Hibernate integration, to attain that.

6 responses to “CFGroovy in Forty Lines”

  1. Hal Helms

    Nice, Barney. I agree with you about sacrificing backwards compatibility — especially at this early stage. Look forward to seeing more!

  2. Joshua Frankamp

    Does this suffer from memory issues? I imagine not because of the single classloader, also no compilation…

  3. Henry Ho

    Just wondering… any advantage of using server["cfgroovy.scriptCache"] as java.util.HashMap instead of plain old CFML struct?

  4. Henry Ho

    Nice… learned something new! :)