CFML and Groovy

So As I said in my last post, there's been a lot of talk about integrating CFML apps with other bits.  I've been playing with Groovy and Grails a fair amount (duh), as well has having a lot of conversations about it.  I've been trying to figure out what the best use case is for the different pieces, and here are what I see as the main alternatives:

  1. Use Grails for your whole app stack
  2. Use Grails for your lower stack, and CFML for the view implementation (instead of GST).
  3. Use CFML for your web layer, and Groovy (maybe via Grails, maybe via plain Spring) for the lower layers, including GORM/Hibernate for persistence
  4. Use CFML for the web and service layers, and using Groovy w/ GORM/Hibernate for the data layer.
  5. Use CFML for the whole thing, and just stick in a bit of Groovy as needed, maybe with a partially GORM/Hibernate-persisted data model.

So what's the right one?  My initial feeling was option three, but after a bunch more talking and thinking, I'm now leaning towards number 4.  The service layer doesn't suffer from the same performance issues related to CFC instantiation that the data layer does.  So using CFML (w/ ColdSpring) has few real downsides for the service layer, but it has definite upsides because you can use CFML within the layer.  Better, you still get the huge benefit of Hibernate and POJOs in the data layer, which is where CF really has a lot of problems.

Interesting times to be sure.  Hopefully when I get back from the conference I'll have more time to write some code and really dig in.

4 responses to “CFML and Groovy”

  1. Joe Rinehart

    I'm leaning a lot towards #3 as well.

    I've found CFML the simplest way to define services that are exposed to multiple protocols without repeating myself…access="remote" making a SOAP service, AMF service, and (supposedly, never used it) Ajax service is just nice.

    As far as Grails is concerned, I've been in my hotel room trying to get it up and running again. IMHO, It's got too much convention built in to make its GORM really usable in a ColdFusion context, and I'm pretty ok managing Hibernate myself.

  2. Joe Rinehart

    Yes. I am zero-indexed.

    (Seriously, yep, #4, that was a typo.)

  3. Kurt Wiersma

    I think #4 is the most appealing as well. Being able to edit a groovy script/class and run it without having to recompile/re-depoly your code is great advantage over java. The integration with Hibernate between groovy is neat, but I hear might be difficult to take advantage of through CF due to how CF works.