Friday, November 27, 2009

Grails - infuriating

I am doing a bit of work in Grails at the moment. For those who are going: "What??", it's a web framework, which intends to allow a developer to build web applications quicker, or better, or easier.

Overall, it is a bit of fun, easy enough to get off the ground, and you don't seem to have to write a great deal of code to get a great deal of result. But doing anything beyond a simple website it seems to get you into ever increasing layers of complexity and time-consumption.

The things I most dislike about it are:

  • There does not seem to be a lot of information out there on it that is beyond the simple stuff, airports and flights, books and authors. I find that if you add the words "finally found an answer" to the google search, it leads me more quickly to helpful people who are also trying to do non-simple stuff.
  • The documentation, particularly the "Guide" is reasonably good and (for a change) well-written, but so many important nuggets of information are buried in it, you find yourself reading and re-reading the same section of doc over and over to try to find answers. You know the answer has to be there somewhere.
  • The specs seem to change markedly from one version to the next. Little things mainly, of course, but it potentially means that when you think you have found the answer to your question, you have to be careful that the answer is still current to the latest version.
  • The community seems to contain more than it's fair share of "that's the way it is, deal with it", or "it is simple, you are stupid" people. It certainly doesn't encourage asking questions when you see some bloke get his arse flamed off for asking the same dumb question that you had. No I didn't notice the subtleties in the previous answer, thanks for pointing them out and displaying your obvious superiority.
  • The Exceptions that are generated when things go wrong in the app are way out there. I guess this is as a result of the way it's built on top of Groovy on top of Java with potential other helper frameworks jammed in. But struth, if it's a database error, then tell me it's a database error and not some other obscure error.
  • Grails uses Hibernate for database access, and getting it to work with an existing database is a real trial. Days worth of work, trust me. Oh so you DON'T want an intersection table with that simple one-to-many relationship? Well you're doing it wrong then. Whether it's complexity is Hibernate's fault or Grails's is debatable, but cripes, sometimes I wonder whether it's easier for me to write a simple SQL query. Much easier than trying to wade through the Hibernate documentation as well.
  • And finally, some things just don't seem to work as advertised. Or perhaps I didn't read the fine print in the advert? For example:

    //// A bug? ILike doesn't seem to work here and an exception is thrown.
    //// At least in this case, the exception is meaningful!
    //list = Customer.findAllByNameILike(params.ajaxParam + '%')
    //// The following does work, though.
    def crit = Customer.createCriteria()
    list = crit {
        ilike('name', params.ajaxParam + '%')
    }


I am not giving up on it yet, it will just take me time to learn. I am thinking though, when I compare it to my experience learning Struts, that while I spent a LOT more time writing code to get to a certain level, I spent a lot less time finding out how to do things. With Grails to get to the same level, I spend a LOT more time finding out how to do something, and then writing two or three lines to code it up! The time spent seems to be about the same.



I am also thinking that Grails may not quite be the Holy Grail of webapp development that I originally was hoping for.

2 comments:

Anonymous said...

Dear Author micsgarage.blogspot.com !
Between us speaking, I would address for the help in search engines.

Michael Lumley said...

Searched high and low for the answer, but to no avail.

I eventually found help on one of the forums, and they corrected my syntax error (Ilike instead of ILike). They were quite friendly about it, which was nice, and certainly made a liar out of me.

The error messages though are still a bit nasty. It definitely didn't help this particular problem.