Wednesday, January 17, 2007

Of ActiveRecord/GORM and DAO Patterns

Emmanuel Bernard of the Hibernate team has an interesting post about his dislike for the ActiveRecord pattern which Grails' ORM tech GORM uses. The interesting thing here is that he points to EJB1/2 as an example of the failure of this pattern.

My personal view here is that EJB1/2 failed because it was god awful, not because it used the ActiveRecord pattern. It was configuration heavy, tied you to the technology by being totally obtrusive, and forced you to think about ORM too much. These are the reasons for its failure.

As far as ActiveRecord from Rails and GORM from Grails go the nice thing about these is how remarkable simple they are to use with zero configuration. This is the power and benefit they offer.

Also you can think in an entirely abstract way about the underlying persistence mechanism. For example with GORM at the moment it is backed by Hibernate, but in the future we plan to implement support for JPA and even possibly support for using GORM ontop of Tangasol Coherence or Terracotta so you can use Grails on top of a data grid solution for massively scalable applications.

With GORM not forcing you to extend any base class and being totally unobtrusive this is all possible. The reality is Java frameworks force you to have a DAO layer, its not out of choice that they exist. Still this is not an insurmountable problem, I'm surprised there aren't more AOP based solutions around. In the meantime GORM is solving real problems.

Tuesday, January 09, 2007

Groovy 1.0 + Grails & Compass/Lucene searching!

What a pleasant surprise it was to get back from my holiday to discover that Groovy 1.0 is out. That is pretty awesome stuff, congrats to the core Groovy guys. Great work!

On the Grails front there has been some nice user contributions over the past week including a great tutorial on how to integrate search with Compass, Hibernate and Grails

However, the story doesn't end here with Glen Smith contributing another fantastic article plus source code about how to integrate straight Lucene into a Grails application with his Groogle search engine he developed in Grails. Nice.

Looking ahead we should have Grails 0.4 out by the end of the month which will represent a huge milestone for the project with it being packed with new features. Stay tuned.