Sunday, April 24, 2011

Roo is not just for CRUD operations

In recent times I met couple of developers who are always skeptical about using a Rapid Application Development tool, like Spring Roo. The main limitation cited after going through a tool like Spring Roo is that it is best fit to scaffold a CRUD user interface. I agree with the developers to some extent because Spring Roo scaffolds user interface which performs CRUD operations on JPA entities. BUT, this perspective is from developers who perceive that user interface is the only important part of an enterprise application. There is lot more to Spring roo, which some developers fail to see. For instance, using Spring roo you can easily develop a sophisticated JPA entity model, consisting of relationships and finder methods.
If you go a little deeper into the Spring roo architecture, and understand the importance of using AspectJ to contain roo-managed code, you'll find that Spring roo is doing lot of heavy lifting behind the scenes to generate the boilerplate code, so that you can only focus on writing the business logic.

A good understanding of what Spring roo does in response to executing a command from roo shell can greatly reduce the amount of boilerplate code you have to write to create an enterprise application. When creating a Spring Web MVC/GWT/Flex application or incorporating Solr, messaging, emailing,Spring security features in your application or developing applications for GAE, lot of configuration information needs to be provided in web.xml or module descriptor or flex configuration file or Spring's application context or web application context file. If you are using Spring roo, most of this configuration is automatically created for you in respective configuration files. 
Roo also manages your pom.xml and configures plugins (like GWT plugin, GAE plugin, Tomcat plugin, Eclipse plugin, IntelliJ IDEA plugin, and so on) and adds project dependencies which greatly boost developer productivity. If you have an understanding of scaffolded Spring Web MVC or GWT or Flex application, then you can also quickly modify it to meet your enterprise application requirement.
Roo is a fast-growing tool and with every new release you see lot more features that can further improve developer productivity. For instance, JSF add-on is planned in the near future, which will simplify developing JSF applications.

Thursday, April 21, 2011

Things that I like about Spring roo

Its been a while since I started working on Spring Roo and in this post I'll summarize my experience working with Spring roo and why I always recommend it to everyone developing Spring-based applications.

1- Tab-completion feature of roo shell while entering commands. If you use tab completion feature while entering roo commands, you'll find that it brings down the learning curve for the tool. You don't need to remember commands word-by-word and let roo help you with find your command. 
2 - Roo's help command gives you enough information about the command. So, if you don't know what optional or mandatory arguments you have to enter for a command, either use tab or simply execute the help command.
3 - Maven-ized project is created with the project command. You have your compiler plugins, eclipse and IntelliJ IDEA IDE plugins pre-configured in your pom.xml file.
4 - Sophisticated support for creating JPA entities. You can specify relationships via roo commands and let roo handle the code generation.
5 - Scaffolding  of GWT, Spring Web MVC, Flex, and so on applications from JPA entities.
6 - Best practices followed in code generation. You can be sure that the code follows the best practices in Spring application development.
7 - Spring roo is for developers who understand Spring, JPA and other technologies used in the application. You can create a simple CRUD application from roo within minutes but if you need to modify the code, then you need to understand the code thoroughly. This is where Spring Roo Cookbook comes into picture :)
8 - One of the most important feature of Spring roo is round-tripping support. If you change a JPA entity, the changes are reflected in the scaffolded GWT and Spring Web MVC applications. This makes it possible to use Spring roo throughout the development of your project.
9. Spring roo will never overwrite the methods that you write. Roo-managed code resides in AspectJ ITDs, and if you never modify the ITDs you can be sure that your code in Java source files will remain intact.
10. You can provide a custom implementation for a roo-generated method in AspectJ ITD by re-defining the method in the corresponding Java file.  So, if roo-generated method in AspectJ ITD doesn't meet your requirement, you have a way to customize it.
11. You can extend roo by writing your own add-ons and deploying it. It may be a bit tricky in the beginning to write an add-on but a quick look at existing add-ons can give you fair amount of idea of how roo generates code. Roo provides commands to create a simple or an advanced add-on to give you a kick-start at writing add-ons.
12. Configuring a maven plugin can be a pain sometimes. Roo-generated applications contain the plugin configuration which simplifies development. For instance, GWT plugin is configured by roo in pom.xml when you scaffold a GWT application from JPA entities, and GAE plugin is configured when you create an application for GAE.
13. Roo supports creation of integration tests for JPA entities
14. Roo supports creation of Selenium tests for Controllers.

Thursday, April 14, 2011

Chapter 6 coming soon

Chapter 6 of Spring roo cookbook will be launched by early next week. Following are the details:
[Chapter 6] - Emailing, Messaging, Spring Security, Solr and GAE [approx. 80 pages]
1. Sending emails using JavaMail API
2. Sending and receiving JMS messages
3. Configuring Spring security for your application
4. Using Spring Security with Apache Directory Server (recipe that makes use of embedded Apache Directory Server and demonstrates use of Web request security and method-level security in roo-generated web application).
5. Deploying a GWT application on GAE
6. Deploying a Spring Web MVC application on GAE (this recipes shows developing a simple Spring Web MVC application and creating owned one-to-many relationship between JPA entities) 
7. Adding search capability to your domain model with Solr 

If case of questions regarding Spring roo cookbook, post it here: