Recent Posts

RSS Feeds

Book Review: Grails 1.1 Web Application Development

This is my review of the book "Grails 1.1 Web Application Development" by Jon Dickson published by Packt Publishing Ltd. in 2009. The subtitle is "Reclaiming Productivity for Faster Java Web Development". The target audience are Java developers looking for ways to develop web applications faster and more easy without throwing away their previous knowledge or leaving the java platform. Grails may be the solution.

Packt Publishing from Birmingham, UK, asked me if I could review their book and I was pleased to be asked and said yes. So I received a complimentary sample of the book soon after. I do own the Groovy in Action book, and lots of free information from around the web but no Grails book so far.

Chapter 1: Getting started with Grails

In the first chapter the reader is motivated by describing the advantages of Grails for development of web applications compared to the classic JEE approach. Next comes a jump into practice: to demonstrate the easy development a simple "Hello, World" application is created after installing Grails itself.
After this hopefully positive experience the project is specified which is to be developed throughout the book to
teach developing with Grails.

Discussion:

The approach matches my personal first contact with Grails as well as the one taken by several books and tutorials in the web on the same theme. The example project is surely one of the most important criteria when deciding which tutorial book to buy. On the one side it has to be general enough to cover most of the aspects of Grails while on the other side being very similar to the requirements and projects you want to develop.

Chapter 2: Managing Users with Scaffolding

In the second chapter a feature of Grails called 'Scaffolding' is explained. With Scaffolding you are capable of creating a fully functional prototype (of a CRUD application) just by defining the domain classes, their relations among each other. Through additional specification of contraints the validation and sorting will be generated without programming. The book uses the example of users and roles.

Some background on Scaffolding:

Scaffolding is a code generation capability of Grails which impresses Grails newbies. It gives productivity a boost. Experienced developers will argue that they don't trust generated code they don't understand. And that Scaffolding will fail as soon as one changes the source definitions. Scaffolding gives you a prototype quickly but it is not intended as a programming by modeling tool like in CASE. The generated code is a starting point which is changed afterwards. And since Groovy code is compact and readable understanding and refactoring is easy.

Discussion:

The quick initial success with Scaffolding motivates the reader to learn more about Grails and continue to read the next chapters. The task of managing users and roles I see with mixed feelings. On one hand almost every application today needs a user and rights management. On the other side there are plenty of ready-to-use solutions like the jSecurity plugin introduced later, container-managed security in application servers and full blown identity management solutions that in enterprise environments are compulsory to be used. A tutorial, a prototype or a standalone web application might build their own solution. For all other purposes the reader should keep in mind that user and rights management have to be delegated to or coupled with existing external systems. Otherwise there is one more application responsible for the account/password hell of today.

Chapter 3: Posting Messages

In chapter 3 developing in Grails really starts. A new function is implemented without the help of scaffolding. A domain class is defined, a user interface is implemented according to the model-view-controller pattern and the database is connected. Internationalization and validation will be included from the very beginning. The needed Groovy code is compact and expressive. Even without Groovy knowledge any Java developer will guess what goes on. The code implements much functionality in a few lines because the defaults of Grails handle a lot of typical tasks. Powerful technologies like Groovy Server Pages (GSP) and Grails object relational mapping (GORM) support this.

Discussion:

Chapter 3 contains a great deal of subject matter and should be worked through slow and with care. Best is following the chapter by real programming. The individual steps are logic and comprehensible. After this chapter the reader should be able to understand what the scaffolding generated and why. To start coding by yourself basic knowledge of Groovy is necessary and therefore will be taught in the next chapter.

Chapter 4: Introduction to Groovy

This chapter introduces the programming language explicitly for Java developers. By using the similarity of Groovy and Java only the differences have to be explained and the coverage of one chapter is enough to explain the basics needed to develop in Grails.

Discussion:

The position of the Groovy introduction chapter is well choosen. Quick results with little prerequisites have whet the appetite of the reader to look behind the scenes and start learning Groovy for changes and enhancements. Just reading the code examples is not enough to be able to write it. The order of the chapters resembles my personal Grails career.

At this point I postpone the remaining chapters to part 2 of my review.

Here's more information about the book in the meantime:


  Share

Permalink    

Related Articles:

Senden Sie einen Kommentar:
Kommentare sind ausgeschaltet.