Java J2EE Portal
Enterprise Java Station
J2EE curve
Java News / Articles
Java News / Articles
Offline Ajax Applications Using Google Gears
Compare Wicket Tapestry JSF Framework
Wicket, Tapestry and JSF side by side
Kill The Java Language - A Message For Scripting Language Leads
Processing...
Buy Java, Deals On Software Technology Store
Click here for great deals on computers, laptops, software and books
Groovy bridges the scripting and the enterprise Java worlds PDF Print
Written by Content Team   
Apr 06, 2006 at 06:26 AM
IndicThreads >> Will Groovy one day become the standard scripting language for Java, which I will get as part of the Java SE / EE download? Is there some Groovy support in Java 6, Mustang?

Guillaume Laforge >> Java 6, also known as “Mustang”, will incorporate JSR-223, “Scripting for the JavaTM Platform”. The current Reference Implementation of JSR-223 provides integration with Groovy, so if you’re using it, you can right away, even on JDK 1.4 or 5.0. You’ll have to use a newer version of Groovy though, because currently, it’s an old beta version which is provided.

"Java 6 “Mustang”, will incorporate JSR-223, “Scripting for the JavaTM Platform”..."

Mustang betas integrate a slightly modified version of JSR-223 which only integrates Rhino, the JavaScript engine from Mozilla. Unfortunately, as far as I know, they don’t integrate Groovy at all. So we’ll certainly have to create our own script engine for Java 6, but be sure we’ll be ready before Java 6 hits the streets.

IndicThreads >> X vs Y always makes for good reading. Can I interest you in a Groovy vs Jython comparison?

Guillaume Laforge >> To be frank, I’m not really interested in making such comparisons. There are many reasons for that. First of all, I don’t know the other languages for the JVM well enough to be able to make fair comparisons. I also don’t want to spread false assertions because of my biased views. And one last reason is I don’t want to “fight” with others on the tune “mine is better than yours”, because it’s a waste of time, and because we’re on the same boat! We all want good scripting languages to embed in our applications, or to write standalone applications!

"We all want good scripting languages to embed in our applications, or to write standalone applications..."

If you’ve been programming in Python for several years, you’ll be at home with Jython, so I guess there’s no compelling reason to choose Groovy if your teammates know Python well. Same thing for JRuby if you already know Ruby well. If you prefer a pure Java syntax with possible weak typing, BeanShell is perfect too. If you also want a Java-like syntax, but with the possibility to use powerful APIs and to be able to do advanced class manipulations with the Groovy Meta-Object Protocol, then Groovy might be a better fit.

"There’s no compelling reason to choose Groovy (over Jython) if your teammates know Python well..."

Each language has its pros and cons, and I can’t really recommend one myself, though my preference would go to Groovy obviously because of its expressivity and its advanced features. It really depends on your use case!

IndicThreads >> How do you decide what goes into groovy? Has Groovy tried to fix any irritants in the Java language? Also have you adopted any ideas from established languages like Python and Ruby?

Guillaume Laforge >> Currently, not much goes into Groovy, because in the following months, before the first release candidate, we’ll be in “feature-freeze” mode. So we won’t add anything new, except potential improvements or bug fixes. Groovy decided to provide a few wrapper classes around common and widely-used APIs. So we’ve got handy classes for dealing with JDBC, for creating Swing GUI interfaces, or for manipulating Ant tasks easily. But what’s clear is that we don’t want to create our own versions of APIs, we’re just offering some syntax sugar to make tedious things simple – like handling connection or stream handling.

"What irritated us with Java was all the boilerplate code we had to write..."

"With (Groovy) closures and ad hoc methods, we can safely forget about those repeating and boring boilerplate code snippets and focus on the main task at hand..."

What irritated us with Java was all the boilerplate code we had to write for iterating over collections for instance, for handling resources properly. With the help of closures and ad hoc methods, we can safely forget about those repeating and boring boilerplate code snippets and focus on the main task at hand. Groovy lets you be more productive in those situations, and let you avoid making some common mistakes like forgetting to close a stream, and so on.

"Once you’re accustomed with the concept of closures, you’re hooked and you wonder how Java doesn’t already support this feature!..."

We’ve borrowed some ideas from well-known scripting languages. The biggest feature is certainly the closures, which are coming from languages like SmallTalk and Ruby. Once you’re accustomed with the concept of closures, you’re hooked and you wonder how Java doesn’t already support this feature!




Add This Feed Button

Enter your Email


Java Expert Interviews
Pradeep Chopra Whizlabs
Certifying your way to success
Satish Talim
Java and J2EE Today: An interview with Satish Talim
JonasJacobiJSFAjax
Pure Ajax creates the next generation legacy applications
Processing...
Go to top of page  Home |
SiteMap

Copyright 2004 to 2008 Rightrix Solutions. All rights reserved. All product names are trademarks of their respective companies. Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Rightrix Solutions and IndicThreads.com are independent of Sun Microsystems, Inc.

Views expressed at IndicThreads.com reflect the views of the authors alone, and do not necessarily reflect those of IndicThreads.com. IndicThreads.com and it's authors are not responsible for reader comments and opinions.

Enterprise Java J2EE JEE Portal >> IndicThreads.com