Grails 1.1 Web Application Development

Grails 1.1 Web Application Development by J Dickinson and Jon Dickinson

Grails 1.1 Web Application Development

Binding:
Paperback
Number of Pages:
328
ISBN:
1847196683
Product Group:
book
Publisher:
PACKT PUBLISHING
Publication Date:
June 1, 2009
BooksForGeeks.com ID:
125

Reviews for Grails 1.1 Web Application Development

  1. An example driven Grails book - Slightly more in depth than Grails Quickstart but more difficult to follow

    Rated 4 out of 5 stars, January 12th, 2010

    This book has two cracking chapters that shone for me (5 stars each). These alone make the book well worth the purchase:
    Chapter 6 - The latter part when Grails Testing Plug-in (now baked into Grails core), Integration Testing and Functional Testing Plug-in get a mention.
    Chapter 13 - Building your own plug-in.
    It also has a really good discussion on Meta programming dispersed over parts Chapters 4 (P79-81), 6 (P125) & 13 (P263-277).

    Plug-ins covered : JSecurity (Ch5) , Searchable (Ch12), RIA stuff (for Tagging) (In-line editing via prototype) RichUI (auto complete & tag cloud), Testing (baked into Grails Core 1.1+), Functional Testing, Of course it creates it's own Tagging plug-in.

    It implements RSS feeds with a custom GroovyBuilder script and adds RESTful web services in Ch12

    GORM is covered in some detail even down to polymorphic querying (Table per Subclass) - Ch 10.

    The book builds a Team Communication portal. Revolving around Messages, Files and Users that can be tagged. So you end up with a blend of features akin to Jobserve with the ability to upload and download files and Meetup, where you can assign meta data to the Files you've uploaded and Messages you've posted. File uploads end up being versionable.
    The tagging capabilities end up being at the heart of the book and this gets introduced by basically extending a base class (Message & File extend Taggable) via Table per Subclass in Ch10. The need to extend a base class is removed when everything gets converted over to a Plug-in in Ch13. During this dramatic transformation, the author shows how to refactor out of an application into a plug-in. Custom GSP tags get included in the plug-in and the ability to classify domain classes via taggable is introduced, in a manner akin to the Searchable plug-in.

    I read this book hot on the tail of Dave Klein's Grails Quick Start (GQS).
    To its advantage this one has more granularity when it came to discussing Tomcat configuration and setting up JNDI datasources (Ch14) and it covered Mac installs too. (Less custom GSPs though). Both books follow the pattern of building a meaty example, refactoring the project over the course of the book. This one has 14 chapters.
    GQS didn't have as many refactorings and didn't boggle the mind. In GQS refactoring was broken down into digestible chunks by chapter.
    You have to refer to the index a lot to look up the last versions of things in this book. (which is thankfully good).
    Things are compounded more by the fact that fragments of code get interspersed as new things get introduced.
    An appendix with an alphabetical list of artefacts and the pages upon which they get updated (with the methods/closures listed under the artefact with page numbers too might work better).
    If the book was broken down into more granular and number subsections with copious back referencing this would work better too.

    The book is good in that in general it doesn't discuss things too much out of sequence, but a slight re-organisation so Groovy was discussed in Chapter 1 and the discussion on Dynamic Finders breaks the flow in pages 92-93. This should been at the end of chapter 1 after the Groovy discussion.
    There was a final refactoring that occurred in Chapter 13 to do Meta-programming and remove the base class from a Domain Class and I couldn't see how this was going to resolve some issues with id attribute generation in the GSP's causing clashes. Suffice it to say the book covered it eventually (P274-277), but a heads-up roadmap of changes ahead, using sub-sections up front would have worked wonders here.

    I think the book could have done with introducing GSP templates from the outset and this could have simplified things a lot with the number of refactorings too. (It first gets mentioned in chapter 10, 190 pages into book).

    Occasionally some naming conventions were a bit misleading, such as:
    defining Cancel for a link, when Clear or Reset would have been more accurate. I think of Cancel as returning to prior page.
    On P152 for the class File rename 'versions' to 'priorVersions'. There is another property called 'currentVersion'. I initially thought the current would be one of the 'versions'. They are mutually exclusive properties. Versions contains archives only, not the current. This made it difficult to comprehend things without reading ahead.

    I wasn't too keen on the use of g:message tags for placeholders or simple concatenation. When simple Groovy Expressions in the GSP would have sufficed. There was even one defined (file.name) that had no message in the message file for the lookup code.
    Some things looked odd in terms of the artefact added Flash messages too. It looked to me like you'd get weird messages because of nested GStrings. This was trivial, but g:message was at the root of this again.

    Baffling areas:
    (slightly) by P155 the currentVersion closure and
    (completely) by P241 Mapping to Variables in Ch12 for URLMappings.Groovy.
    (unsure) when search returns Messages without initialised User - Ch12 P233. whether this would have repercussions in trying to wipe out the 'user' property. The property wasn't nullable. Pondered whether an exception would be thrown when tags were changed.
    (unsure) why cloudData static on P278 & P221 not static. I think P221 should have been static too.
    There were some odd things where g:links were embedded in anchor tags too, that seemed to muddy things somewhat. But there may have been some quirky CSS styling issue at play. This isn't printed in the book anywhere. You are just given a link to download the artefact. I would have preferred this to have been in an Appendix.
    P169 If the fileid is invalid, the code silently drops through to return a new file in the Service. I was unsure whether this was best course of action for an invalid fileid
    P197 lastUpdateSort method. Use the spaceship operator to simplify code. private lastUpdateSort = {one, other -> one.lastUpdated <=> other.lastUpdated}
    P245 text/html -> text/xml

    You can find a review of this book in GroovyMag too in the Sept 2009 issue by Erik Weibust.
    If you want to know more about building plug-ins (The Grails uber feature!)
    - GroovyMag has you covered here too when Mike Hugo covers it in the Feb 2009 issue.
    - Russ Miles also gave a talk on Skills Matter. Search on Bringing Killer New Features to Grails with Grails Plugins and the Spring Portfolio.
    - Harshad Oak, the reviewer of this book is writing an upcoming APress book. Pro Grails Plug-ins (ISBN-10: 1430228563)

Our Network

BooksForGeeks.com is a participant in the Amazon Europe S.à r.l. Associates Programme, an affiliate advertising programme designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.co.uk