(Opinion!) After 3 years of Grails development it is time to take a step back and look how well we went.
After 3 years of Grails development it is time to take a step back and look how well we went.
(Info: we made several Grails apps ranging from small (<15 domain classes) to medium sized (50-70 domain classes) using front ends like Flex/Flash and AJAX)
The good parts
Always start with praise. So I tell you what in my opinion was and is good about developing in Groovy and Grails.
Groovy is Java with sugar
The Groovy syntax and the type system are so close to Java, so that when you come from a Java background you feel right at home.
Standard web stack
If you are accustomed to standard technologies like Spring and Hibernate you see Grails as a vacation.
Sensible defaults aka Convention over configuration
Many of the configuration options are filled with sensible defaults.
Fast start
You get from 0 to 100 in almost no time.
The bad things
Things which are not easily avoided.
Bugs, bugs, bugs
Grails has many, many bugs, unfortunately even in such fundamental things such as data binding and validation. A comment from a previous blog post: “To me, developing with Grails always felt like walking on eggs.”
Regression
Some bugs sneak back in again or are even reopened. Note that this is not the same as bugs, bugs, bugs because fixed bugs should be secured by a test.
Leaky abstractions
You have to know the underlying technologies especially Hibernate and Spring to get a foot on the ground. The GORM layer inherits all the complexity from Hibernate.
Slow integration tests
The ramp up time is 45 s on a decent build/development machine and then the first test hasn’t even started.
Uses the Java way of solving problems
Got a problem? There’s a framework for that!
Abandoned or prototype like plugins
Take a look at the list of plugins like Autobase, Flex.
Problems with incremental compiling
Don’t know where the real cause is buried: but using IntelliJ for developing Grails projects results in comments like:
Not working? Have you cleaned, invalidated your caches, rebuilt your project, deleted the .grails directory?
The ugly things
Things which are easily avoided or just a minor issue.
Groovys use of == and equals
Inherited from Java and made even worse: compare two numbers or a String and a GString
Groovys definition for the boolean truth
0, [], “”, null, false are all false
Groovys use of the NullObject and the plus operator
Puzzler: what is null + null ?
Uses unsupported/discontinued technologies
Hibernates SchemaExport comes to mind.
Mix of technology and intention
hasMany, hasOne, belongsTo have not only an intention revealing function but also determine how cascading works and the schema is generated.
Summary, opinionated
Grails has deficits and is bug ridden. But this will be better in the future (hopefully).
When you compare Grails with standard web stacks in the Java world you can gain a lot from it.
So if you want to know if you should use Grails in your next project ask yourself:
- do you have or want to use Spring and Hibernate?
- can you live without static typing? (remember: with freedom comes responsibility)
- are you ready to work around or even fix an issue or bug?
- is Java your home?
If you can answer all those questions with Yes, then Grails is for you. But beware: no silver bullets!