Author Interview: Dave Klein on Grails: A Quick Start Guide
Author Interview: Dave Klein on Grails: A Quick Start Guide
Join the DZone community and get the full member experience.Join For Free
Get the Edge with a Professional Java IDE. 30-day free trial.
I recently had the opportunity to interview Dave Klein, the author of DZone's Getting Started with Grails Refcard and Grails: A Quick-Start Guide for the Pragmatic Programmers, affectionately known in Twitter circles as "GQuick." You may have noticed, if you've checked out the back cover, that I think this book is "Quite possibly the best introductory book I've ever read about any framework, not just Grails." That opinion still holds true today. So without further delay, let's get to the interview:
Matt: So Dave, why don't you introduce yourself briefly to our readers?
Dave: OK. My name’s Dave Klein and I’m a homeschooling father of 13, married to a beautiful DOS power-user. (Anybody need any batch files written?) I’ve been developing software in one form or another for 16 or 17 years, and have played almost every role in the development process. I founded the Capital Java User Group in Madison, Wisconsin and the Gateway Groovy Users in St. Louis, MO. I’ve presented -- on Grails -- at SD West, JavaOne, and most recently at SpringOne2GX (along with you, Matt). I write a monthly news column and a plugin tutorial for GroovyMag, and recently wrote the book Grails: A Quick-Start Guide for the Pragmatic Programmers.
Matt: Great! For the uninitiated, how about giving us a quick overview of Grails and what it offers for today's developer?
Dave: Grails is a full-stack web development system for the JVM. Grails includes best-of-breed frameworks like Spring, Hibernate, Sitemesh, Ant, Ivy and others, and uses the Groovy language to make them all easier to work with than ever. Grails also takes advantage of design principles such as DRY (Don’t Repeat Yourself) and Convention over Configuration to provide an environment that is more productive and enjoyable than anything seen before in Java development.
Matt: At the time GQuick was being written, there were already several Grails books on the market. What are you offering that was missing?
Dave: The books that were available were great for those already working with Grails, or at least committed to working with it. What was missing was something that provided an easier entry point for those just getting started or just looking into Grails. My goal was to help ease the transition into Grails, and provide a gateway to the other more in-depth resources. In fact, I include a list of the other available books in the Appendix of GQuick.
Matt: Who were you trying to reach with this book?
Dave: The book is aimed at web developers in general, with a slight emphasis on Java web developers since they are the ones with the most pain – though I’ve heard from PHP and Rails developers that have read the book and found it helpful. I don’t assume a great deal of expertise, but some basic understanding of web application concepts is assumed.
Matt: Why should I choose Grails over many of the other alternatives in this space (Rails, Play, etc.)?
Dave: The easy answer is that Grails is better than all of them, although I admit I am biased. But seriously, the main reason one might choose Grails over Rails is the JVM and the vast array of tools and libraries available in that environment. Even with JRuby on Rails, you will not have the easy and seamless integration with those resources that Groovy provides to Grails developers.
Since Grails came out, other frameworks for the JVM have appeared that address some of the problems solved by Grails, but I don’t think any of them have gone as far as or are as mature as Grails.
Matt: What's the one Grails feature that you absolutely can't live without?
Dave: This might be cheating, but I’d say GORM. The reason I say that might be cheating is that GORM (Grails Object Relation Mapping) is really a bundle of features. GORM dynamically adds full persistence capabilities to our domain classes, simply because they reside in a certain directory. We don’t need to implement any interface or extend any class. And the way that persistence is provided is so simple and unsurprising. Sometimes, while learning Grails, a person will ask how to do a certain thing, and I’ll ask them “How would you do it?” Quite often that’s the way you do it. You save an instance with instance.save(). You delete an instance with instance.delete(). You get an instance with DomainClass.get(). You find an instance based on properties with DomainClass.findByProperty() or find more than one with findAllByProperty(). What if we wanted to find all objects with a color of blue and a size that is greater than 10? Hmm… how about findAllByColorAndSizeGreaterThan(‘blue’, 10) ? I love this stuff!
GORM also provides features like schema generation, a powerful mapping DSL to work with legacy databases, Criteria support, and more. All of that easily makes it the most powerful feature in Grails.
Matt: In Appendix A, you offer the most comprehensive overview of the G3 (Groovy, Grails, Griffon) community that I've seen. How did you ever assemble it?
Dave: Well, the G3 community is my second favorite feature of Grails. The people involved in this community are some of the smartest and most helpful people I’ve worked with in my career. I’ve been involved with other technologies before, but none like this. So I figured that anyone getting into Grails should be introduced to the community too.
I didn’t have to do very much research to come up with the list of blogs and other resources, since most of them were already in my RSS reader or bookmarks. You can find these people wherever you look. Take a look at the up votes on a Groovy-related DZone article, or do a search for #grails in Twitter, and you will see many of the names in the appendix. If you go to a conference like JavaOne or Devoxx, keep an eye out for the Groovy table in the dining hall. It’ll be there.
This community of developers obviously provides a wealth of resources when you need help, but it’s more than that. They challenge and inspire you, and generally make your job much more enjoyable. Even if you never get the chance to work with one of them directly, they are your colleagues.
Matt: Where do you see Grails and the Grails community headed over the next few years?
Dave: I predict that over the next few years Groovy, Grails, and Griffon adoption will continue to climb as tool support gets better and better and more people see just how much more productive they can be. I think that the growth in the community will present both challenges and opportunities. I’m looking forward to both!
Matt: You were recently named the sponsorship coordinator for the Gr8 in the US conference. Any chance you'll be using TekDays to get things done?
Dave: I have to say the thought did cross my mind. I’m not organizing the Gr8 Conference though, so that will be up to the organizers, Shaun Jurgemeyer and Bill Turner. My sons, Zak and Ben, are working on getting tekdays.com ready for beta, and the Gr8 conference would be a great way to test it out.
Speaking of the Gr8 Conference, it is coming up on April 16th in Minnesota. Keep an eye on the blog for more information.
Matt: Is there anything else you'd like to share with our readers?
Dave: If you are doing web development and haven’t taken a look at Grails yet, please do. You’ll likely be hooked, and even if you’re not, you will at least get some ideas of things you can do better in your framework of choice.
If you are using Grails but are not actively involved in the community, get involved. Check out the mailing list. If you have a question, chances are someone else has had that same question or will. Check out sites like groovyblogs.org or the GroovyZone or GroovyTweets. Find a user group in your area or start one. I was serious when I said that the community is one of the best parts of working with Grails, and the community gets stronger when people get involved. Thanks!
Opinions expressed by DZone contributors are their own.