Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Roo vs. Grails

DZone's Guide to

Roo vs. Grails

· Performance Zone
Free Resource

Download our Introduction to API Performance Testing and learn why testing your API is just as important as testing your website, and how to start today.

We had a requirement where we had an application in production and was developed in Spring MVC and the velocity of implementing new features were slow. We had to explore alternate frameworks like Grails and Roo. I personally spent close to a month exploring which one was better.

We explored following features in both these and below is our findings. We explored following features in both these and below is our findings. The final verdict is we have still not finilized on either one, we are still exploring

  • Support for database migration from existing application to these frameworks
  • Support for Spring Security with existing user authentication/authorization model for these frameworks
  • Support for standard features like reporting
  • Support for ajax frameworks like JQuery, Dojo, GWT, Flex

Both of these frameworks are well integrated with STS IDE. If you have to use these framework, configure STS IDE and start developing, dont use command line, you cannot take advantage of roundtrip code generation capabilities.

Roo:

This framework is 100% Java roundtrip engineering RAD framework which is used to develop any Spring application including web application using Spring MVC, and Ajax based views. The deal breaker here was, Roo was very buggy. It has addon for lot of tools like Jasper/ JQuery/Flex etc.. but most of them wont work out of the box with 1.2.1.RELEASE. It is wasy to build a simple prototype but build or reverse engineering enterprise web appliction is not easy. One aspect favorable to it is since it is Java based, people who understand Spring MVC, Spring Webflow etc, can take advantage of it.

Support for database migration from existing application to these frameworks:

In Spring Roo 1.2.1.Release database reverse engineering the database to DAO, DTO comes out of the box, the roo command is as below,

database reverse engineer --schema PUBLIC

Support for Spring Security with existing user authentication/authorization model for these frameworks

When you run the command security setup it will provide all the security plumbing including a login page and default spring security context file.

If you have to customize it, you need to configure in the spring applicationContext-security.xml file as below,

<http auto-config="true" use-expressions="true">
	<form-login login-processing-url="/resources/j_spring_security_check" login-page="/login" authentication-failure-url="/login?login_error=t" />
	<logout logout-url="/resources/j_spring_security_logout" />
	<!-- Configure these elements to secure URIs in your application -->
	<intercept-url pattern="/users/**" access="hasRole('admin')"/>
	<intercept-url pattern="/roles/**" access="hasRole('admin')"/>
	<intercept-url pattern="/userrolesmaps/**" access="hasRole('admin')"/>
	<intercept-url pattern="/" access="isAuthenticated()" />
</http>
<!-- Configure Authentication mechanism -->
<authentication-manager alias="authenticationManager">
<!-- SHA-256 values can be produced using 'echo -n your_desired_password | sha256sum' (using normal *nix environments) -->
	<authentication-provider>
		<jdbc-user-service data-source-ref="dataSource"     users-by-username-query="select email_id, password, active
		from custom_user where email_id=?"
		authorities-by-username-query="select u.email_id, r.name from custom_user u, custom_role r, custom_user_roles_map ur
		where u.id = ur.user_id and ur.role_id=r.id and u.email_id=?  " />
	</authentication-provider>
</authentication-manager>

Support for standard features like reporting

There is already an addon in Roo for Jasper reporting from gvnix, sadly this did not work out of the box, I had to write a new controller to plug into Jasper using Maven and write ton of code

Support for ajax frameworks like JQuery, Dojo, GWT, Flex

Again I was not able to make Flex work with Roo out of the box. Dojo comes bundled with Roo out of the box and it is Ajax enabled. Roo also works with GWT, but making Spring Security work with GWT was a challenge. There is no addon to JQuery.

Grails:

This framework is Groovy based, there is a learning curve involved for Java / Spring MVC developers to learn this new langauge, but let me tell you it is worth an effort. This is purely a web development platform. And among these 2 frameworks, this one is more stable and has better overall addon support with minimum bugs. There is also good JQuery /Ajax support.

Support for database migration from existing application to these frameworks:

There is a db-reverse-engineer addon, which can create a whole set of plumbing like Dto, Dao etc in Groovy

Support for Spring Security with existing user authentication/authorization model for these frameworks

It does provide spring security support with sample user authentication groovy code ready to be use, but if you want to configure it to work with existing schemas, it was not easy. And there is not lot of documents on the web to show how to implement

Support for standard features like reporting

Still exploring

Support for ajax frameworks like JQuery, Dojo, GWT, Flex

Still exploring

Find scaling and performance issues before your customers do with our Introduction to High-Capacity Load Testing guide.

Topics:

Published at DZone with permission of Krishna Prasad, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}