Grails in Action

Grails in Action
Authors
Glen Smith, Peter Ledbrook
ISBN
1933988932
Published
28 Jun 2009
Purchase online
amazon.com

For web developers used to wrestling with Java and XML, Grails is a breath of fresh air. Developers are instantly productive, picking up all the benefits of the Ruby-based Rails framework without giving up any of the power of Java. Grails in Action is a comprehensive look at Grails for Java developers. It covers the nuts and bolts of the core Grails components and is jam-packed with tutorials, techniques, and insights from the trenches.

Page 2 of 2
  1. Editorial Reviews
  2. Customer Reviews

Customer Reviews

J. Pedersen said
I have had issues with other Grails books being out of date (not this book). One book I was reading had been written for Grails 0.5 or so, and I spent about 3 weeks with it ... before giving up (things have just changed enough in Grails that I could not get their examples to work).

I did not run into that issue with this book (this was the 3rd book I tried following, the 3rd time was the charm). The downloadable associated code was written for Grails 1.1.0 (I think they should update it to 1.1.1, but it did not cause me significant problems).

The writing style is refreshing, not really boring "computer book" prose ... but more of a story telling style, yet not needlessly wordy. This is the type of writing that I would aspire to if I were writing a technical book.

The thing that stood out to me was the depth and breadth of the coverage. The authors take you on the standard Grails journey of using Controllers, Views and Domains and GORM, and Unit and Integration testing with (with JUnit extensions built into Grails), and functional testing with the HtmlUnit plugin.

They then take you on a journey through a large number of the available plugins, which make Grails development very productive. This includes coverage of the Spring Security plugin (acegi), scheduling with Quartz, messaging with ActiveMQ, a chart drawing plugin from Google.

They also take you through implementing a REST api.

They finally take you through the process of developing your own Plugin.

So, as I said ... the breadth of material is excellent, and the details given to allow you to use that breadth of information is also top-notch.

One minor issue I have, relates to a strength of the book as well. They include source code and then a commentary on the source code. They don't go into nauseating Deitel-like description of "here we add 1 to the variable", but there are some comments that would probably have been better left out.

Dustin Chesterman said
I enjoyed this book and learned everything i thought i needed to know to start building robust grails apps

Michael G. Kimsal said
I've been following Groovy and Grails books for a couple years now, and own nearly all of them. Each one has filled a niche, and almost all have been great in letting the voice of the authors come through while keeping the style of the publisher (Manning books have a different feel from Apress, for example).

I had high hopes for this book, and wasn't disappointed. It had tough competition from the recent The Definitive Guide to Grails, Second Edition (Expert's Voice in Web Development) but I think this book *slightly* edges out that one as a Grails resource. Why? It's slightly more up to date, for starters. The chapters on dealing with legacy databases and on adding security to an app were both a bit more informative, or at least I found them a bit easier to follow. This is not to detract from the DGG. If you *can*, I'd recommend owning both, as each presents similar information in a unique style. The Grails in Action book feels somewhat more conversational, which made the reading easier for me.

There's a lot more substance other reviewers have given on this book - I'm not sure I'm going to go in to as much detail as they have. Suffice it to say that this is currently my book of choice for working with Grails these days. Glen and Peter have packed an incredible amount of information in to 500 pages, with concise writing, useful examples, and just enough humor to keep it entertaining without losing its utility.

For most of 2008, I was recommending Beginning Groovy and Grails: From Novice to Professional (Beginning from Novice to Professional) from Christopher Judd and company. For my money it was *the* book for 2008 for Grails developers. I think given the advances in the past several months, both the new DGG and this new Grails In Action book deserve to share the title of "Best Grails Book". You can't go wrong with either book.

As an aside, I'd also recommend Groovy and Grails Recipes from Bashar Abdul-Jawad if you're looking for a companion piece to Grails In Action. It provides a 'recipe' approach to quickly finding the code snippets you need to solve a particular problem.

Trevor Burnham said
I've read both this book and the older Definitive Guide to Grails, Second Edition, and I'm happy to report that Grails in Action is both more concise and better-organized than that other (nonetheless excellent) tome. It is also slightly cheaper and, until Grails 1.2 is released (it's in early milestone as of this writing, so I wouldn't expect it to be production-ready before 2010), pleasingly up-to-date. There are very few errors, and if you find any, the authors will be happy to help you sort them out in the book's official forum.

The book's great strength is its organization. There's all kinds of online documentation for Grails, including a decent reference manual at grails.org, but searching through the mailing lists and the JIRA when the framework does something unexpected is no fun at all. Grails in Action starts off right with a primer on Groovy (which I found refreshing, even though I've read Groovy in Action), then jumps into practical Grails concepts, which it teaches by example. (The central project of the book, a low-budget Twitter clone, is an excellent showcase for Grails.) The later chapters introduce advanced concepts that are extremely useful but not covered (or not covered well) in Grails' documentation. For example, Chapter 13 tells you how to improve database performance by setting up and enabling EhCache; how to use p6spy and sqlprofiler to easily time your database queries; and how to migrate your database using Liquibase. Other chapters talk about concepts like REST and JMS with surprising clarity.

Whether you're a beginner or an experienced Grails developer, I'd say that this is the only Grails book you need.

Surya Suravarapu said
I've written this review on my blog, reproducing it here:
-------

The book is organized into four parts:
* Introduction: The very first chapter is aptly titled as `Grails In a Hurry'. If you are a complete beginner to Grails you will be blown away with the productivity and the powerful feature set of Grails on display. Many concepts explained in detail in the later chapters are summarized with a simple example. Second chapter goes over Groovy basics, which is adequate.
* Fundamentals: I think taking up a non-trivial example to explain the concepts of a framework is nice. A Twitter-like application is built during the course of this part of the book. This part explains about using GORM (Grails Object Relational Mapping Library), techniques for using Constraints for validation, power of Grails scaffolding, usage of dynamic queries, controlling application flow and the usage of services, introduction to GSPs and the discussion about views and layouts (along with AJAX stuff).
* Building more features into your applications: How well different levels of testing (unit, integration, functional) are integrated into the framework is discussed. This part then continues with the basics of plugins and their usage. One of my favorite chapters in this book follows next, workflow with Grails Webflow. Security is discussed in some detail, but the chapter that follows really stands out (especially for a huge REST fan like me) -- explains how to design and implement a RESTful API showcasing Grails support for this architectural pattern.
* What you need to know for real work: The last part of the book explains about -- messaging and scheduling, some advanced GORM concepts, how to use Spring and transactions with Grails, and about plugin development. The chapter on advanced GORM concepts is well written; folks who intend to use Grails for enterprise-level applications will certainly benefit from this chapter.

This is my first formal reading of a Grails book, but have some decent exposure to the concepts of Grails (from the available documentation, and by the presentations that I attended in the past). So for me, introductory chapters and some of the fundamentals are well-needed refreshers, but the last two parts really stand out. Some points from my notes:
* For integration tests, Grails bootstrap the database and wires up all components just as it would for a running web app.
* Domain class relationships (1:1, 1:M, M:N) are explained quite well from the Grails point of view -- belongsTo variations, hasMany and GORM magic of automatically adding new methods to account for the defined relationships.
* Groovy querying with dynamic finders: Dynamic finders take advantage of funky Groovy metaclass magic to intercept all method calls on a domain object; leverages Groovy's methodMissing feature.
* Use flash scope for passing messages to the user when a redirect is involved.
* Extensive discussion on the Grails form taglibs, and on creating your own tags.
* Mocking is built-in the framework for productive unit testing.
* Webflow introduces a new scope: flow scope. Items put in flow scope live for the life of the flow. Favor flow scope over session scope -- Webflow will cleanup the storage for you and give you more efficient server memory.
* The chapter on implementing the REST architectural pattern is a must read; Grails supports the pattern out-of-the-box.
* Grails uses OSCache as its default cache library (for Hibernate's second-level cache). The reason suggested was that it plays well with Grails developer restarts, something I would like to understand further in reference to Ehcache. But the authors actually used Ehcache in the book suggesting that it is a better library (I agree!).
* So easy to declare caching at the domain level:
static mapping = {
cache: "read-write"
}
* Discussion on integrating with legacy databases is interesting, but would like to see some case studies to understand the real pain involved.
* Transactional services are implemented using Spring's AOP mechanism (Spring's TransactionProxyFactoryBean).
* Integration tests run inside a transaction by default, which is then rolled back after each test finishes. This ensures that data changes don't affect other tests, but it means you can't check whether transactions are rolled back or not. If you want to test transactional behavior then you need to add a static transactional property to your test.

Conclusion
----------
The book is very well organized and the topics chosen are well thought of. An easy conversational tone is used through out the book. In my opinion, this book succeeds in building a sustained interest about the framework. It is also an excellent reference book on the topic. Strongly recommend the book for all Grails enthusiasts.

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“It works on my machine.” - Anonymous