Spring Roo Cookbook - from Packt - Reviewed
Here is a review of a book I bought while still in "Early Adopters get the incomplete ebook" phase. Spring Roo Cookbook from Packt Publishing.
Title: Spring Roo 1.1 Cookbook Reviewed
Author: Ashish Sarin
Publisher: Packt Publising
Reviewer: Alex McLintock
[ This review refers to the ebook RAW edition which was not complete at time of writing. In particular chapters 5 and 7 were read in draft form. ]
Spring Roo is a code generation system for building CRUD style applications using the Spring framework for Java development. I am told that is a bit like Grails. My advice is that if you are building a web based application for Creating, Reading, Updating, and Deleting database records in Java, and you want to use Spring, then trying out Spring Roo is a good idea.
I've been looking at Spring Roo for some time but thought that the existing documentation lacked something. It seemed to be a topic which required lots of examples - and here we have them.
Although this cookbook doesn't replace the project documentation entirely it does go through most of the basic functionality you might need. At its core the cookbook includes a number of roo scripts which basically describe the sort of project you want to build...
* What your app is called.
* What logging do you desire
* what style of database
* database connection details
* what tables are in the database (or rather what entities exist in your problem domain)
* what the spec of those tables are.
* how they relate to each other
* what sort of web gui you want
It generates a maven style project for you which includes all the necessary libraries, and if you want, will turn that into an Eclipse project too.
The cookbook takes you through this in manageable steps with lots of the recipes adding features to a flight booking application. What pleased me is that the book does not assume you are totally familiar with Spring (as the official documentation does). Of course it is not going to teach you everything you might need to know about Spring. Instead it attempts to explain what Spring Roo actually generated and thus gives you a good start if you want to learn more.
My main criticism is not of the book, but more to do with Spring Roo. The cookbook kind of assumes that everyone wants to create CRUD applications and nothing else. You are left to figure out for yourself how to deviate from that. It concentrates on Apache Tiles 2 - because that is what Spring Roo uses by default. It concentrates on JPA as the database abstraction layer - [sarcasm alert] but then everyone on the entire earth uses Hibernate, don't they?
And of course, the Aspect Orientated Programming takes some getting used to.
There are two chapters on JPA which is perhaps the most important area. A chapter on Spring Web MVC which is really quite helpful if you haven't been using it all your life.
In my book the hot topic nowadays is GWT support and Chapter 5 talks about that, along with integration with Flex and Spring Web Flow. I am no GWT expert, but it is easy to see how much more sexy the generated app looks as a GWT one. I have to admit I don't know anything about Flex so skipped that bit.
Chapter Six is a bit of a grab bag of topics that didn't fit in any other chapter. It starts talking about some of the ways we can deviate from a simple CRUD application. It talks about how you might add mail capabilities (for user notification, for example), use messaging systems such as Apache MQ, deploy to Google App engine, and integrate with Apache SolR for search. (Though presumably the last two can't be done at the same time....?)
The final chapter serves a dual purpose. Either you decide Spring Roo is such a great tool for you that you decide you want to create some add-ons so that it creates the style of application *you* want. Or alternatively you want to remove all dependancy on Spring Roo and turn your project into a normal Spring project.
I can't say that I fully understand add-ons yet. I understand how to use them, but not to create my own. I'm not sure it has much of a place in this book because it is a more advanced subject - but I hope it remains and isn't taken out of the draft chapter.
As for removing roo from projects? That bit wasn't available in the draft I read.
All in all a good book which I can recommend as a first Spring Roo book. I don't know how it compares to others in the market, but I will be keeping an eye out for them.