Tuesday, 15 November 2011

Spring Roo - An excellent RAD tool

Recently, I had a look at Spring Roo,  http://www.springsource.org/roo 
Roo is part of Spring family and it is an open source Rapid Application Development tool for Java developers. Spring based applications performing CRUD (Create, Read, Update, Delete) on Entities can be easily built using Spring Roo. It is not an IDE or a runtime. It is just a programming methodology combined with a code generation tool. 
To set up an application using Spring Roo, you may need to enter a few commands on the Roo shell. After that you can create your entities and add fields to it. Roo shell running in the background will create all the artifacts required. The application will be ready to run with full CRUD operations for the entity. 
Generated artifacts include 
• A listing screen which lists the entities in a table with pagination. Delete and update can be triggered from this screen 
• A create/update screen to create/update one entity. 
• A view screen to view one entity. 
• Spring MVC Controller class for performing the operations on the entity 
• Java bean setters and getters for entity. 
• Persistence logic for all CRUD operations for the entity. 

Finder Generation 
If there is a requirement to filter the listing based on a few parameters, finders can be generated. You just need to add an annotation to the entity and Roo will create the screen and corresponding logic for the same. 


Excellent Roundtrip handling 
Most of the Roo generated codes can be edited manually. Roo shell will automatically detect that and adjust the application accordingly. Even when Roo updates those files later, the manual changes will not be overwritten. 


It is nothing but Spring 
This is one of the unique features of Roo. The generated application is nothing but a normal Spring application. It gets the entire strength of the robust Spring framework. It is easy to build all the NRFs into the application. For example, authentication and authorization can be performed using Spring Security.  This makes Roo a strong candidate for developing enterprise applications, without compromising on NFRs.

Maven Dependency Management 
Dependency management in Roo is very easy as it is handled by Maven. As and when new features are added to the application, roo will automatically update the pom.xml and maven will download the dependencies. 

JSR-303 Bean Validation 
Spring Roo performs data Validation based on JSR-303 annotations. 

Integration with industry standard frameworks 
Other than spring, it has off the shelf integration with industry standard frameworks like Hibernate, Spring MVC, log4j, Google Web Toolkit, Solr search engine, EclipseLink, OpenJPA etc. 

Roo independent runtime 
The role of Roo ends in development cycle. The runtime of your application does not have a dependency with Roo. Spring Roo even provides a guideline on how to remove Roo from the application without affecting the functionality. 

Eclipse Based IDE 
Easiest way to develop in spring roo is to use STS (Spring Tool Suite) which is nothing but eclipse with a few extra plugins. 

Flexibility 
An important advantage of Spring ROO is that it gives you maximum flexibility. Once you do the automated generation, almost entire code is at your disposal, and you can do any modification to that as you wish. The generated code is very clean and easy to understand. So even though you are working with generated code, you will not have any restrictions of generated code. 
And it is not mandatory that you following Roo based approach for all screens. You can use Roo to build your simple CRUD functionality and use a normal Spring MVC-Spring-Hibernate architecture to build complex functionality. As the technology stack is generally same, they can easily coexist. 


In any enterprise application, a large amount of functionality is simple CRUD. Spring Roo can surely improve productivity in developing such applications. 

3 comments:

  1. John, congrats. Do you think this is the direction in which enterprise application development would progress? I had seen similar features in grails, a groovy based tool.

    ReplyDelete
  2. Thanks Robin.
    Grails is also a similar tool, again from Spring Source. The key difference is that Roo generates code during compile time, while grails acts on runtime. This gives Roo more flexibility (and some complexity, when compared with Grails) because entire code will be at your disposal, and you can modify it as you want. Roo will also get full capability of Spring, which is very important for an enterprise application.
    In my opinion, grails is ideal for a non-technical person to generate a web application quickly and Roo is ideal for a true developer.

    To answer your first question, Roo may not become the primary framework for enterprise application development. But it can surely contribute to a considerable chunk of the development, and thus reduce the total effort

    ReplyDelete
  3. Thanks for the share. Keep posting such kind of information on your blog. I bookmarked it for continuous visit.
    html5 player

    ReplyDelete