Thursday, 17 May 2012

Introduction to Spring Roo

Anyone who has worked with enterpeise Java in the past will know that it can suffer from productivity issues when compared with platforms like .NET. The Spring framework has gone a long way toward addressing these issues and as a result things has improved dramatically since the early days of J2EE. However, enterprise Java still has a long way to go in terms of productivity - The Spring community has recognised this and in an attempt to address the issue they've developed Spring Roo.
What is Spring Roo?
Spring Roo is an easy-to-use productivity tool for rapidly building enterprise applications in Java. It leverages existing enterprise Java technologies such as Spring MVC, Hibernate, JSP, tiles, Spring security and Maven. Roo provides automatic setup of these technologies into a best-practice application architecture and, if you wish, automatic maintenance of all files required by those technologies (such as XML, JSP, Java etc).  This use of standard technologies allow developers to start using Roo alongside their existing Java knowledge, skills and experience.
Roo is not a runtime, so Roo is not involved with your project when it runs in production. You won't find any Roo JARs in your runtime classpath or Roo annotations compiled into your classes. This is actually a key benefit, it means you have no lock-in to worry about and you can remove Roo from your project in just a couple of minutes if the need arises. It also means it should be much easier to get approval to use Roo as its  more like a command line tool than a critical runtime library like the Spring or Hibernate. It also means there is no way for Roo to slow your project down at runtime, waste memory or bloat deployment artefacts with JARs. Roo was developed so as to impose no engineering trade-offs - this was one of the central design objectives.
How do I use Spring Roo?
Roo is loaded up in a "shell" window and can be left running in the background. You can interact with Roo via commands typed into the shell if you like, but most of the time you'll just go about programming in your text editor or IDE as usual. As you make changes to your project, Roo intelligently determines what you're trying to do and takes care of doing it for you automatically. This usually involves automatically detecting file system changes you've made and then maintaining files in response.
Why use Spring Roo?
  • Higher Productivity
Roo has been developed to so that enterprise Java developers can enjoy the same kind of productivity that developers on other platforms take for granted. 
  • Standard Java Technologies
Roo projects use standard Java frameworks such as the Spring Framework, Spring Security, Spring Web Flow, Maven, JSP, Hibernate, Tiles and AspectJ. These technologies are commonly used in enterprise Java projects, so it’s likely that developers are already familiar with them.
  • Easy to Use
Roo’s command shell uses tab completion for completing all mandatory arguments step-by-step. There is also the ‘hint’ command which suggests what you may wish to do next based on your present project's state. It's pretty easy to build an entire Roo project simply by typing "hint", pressing enter, and following the instructions Roo presents.
  • No Engineering Trade Offs
Roo doesn't impose any engineering trade-offs on your project. Roo applications will typically have a smaller deployment artefact because it uses an incremental dependency addition approach, where dependencies are only added to your project as they are needed. This means the deployed application should operate more efficiently in terms of CPU and memory consumption. 
  • Easy To Remove
Architects and developers who introduce new technologies into a solution should be aware of the associated technology risk. With this in mind Roo was developed so that it can be easily removed if needs be. One of the biggest risks when adopting a new tool like Roo is the ease at which you can change your mind in the future. There are a number of reasons why you may want to remove a tool from your development ecosystem, such as changingrequirements, a better alternative emerging, the tool having an unacceptable number of bugs, or the tool not adequately supporting the versions of other software you'd like to use. In commercial software development it's important to take the appropriate steps to mitigate these risks.
In my next post I’ll detail a step by step guide to building a fully functional Spring MVC application with Spring Roo.

No comments:

Post a Comment