Java is Groovy and Groovy is Java
by Stii
groovy |ˈgroōvē|
adjective ( groovier , grooviest ) informal dated or humorous
fashionable and exciting : sporting a groovy new haircut.
• enjoyable and excellent : he played all the remarkably groovy guitar parts himself.
That is as defined in my beloved and trusted Mac Dictionary. I have to do a little Java project soon. Not because I want to, because I HAVE to for Afrigator. Don’t get me wrong, I think Java is great and powerful. I have a healthy dose of respect for it. Problem is, I’ve never done anything remotely formal in Java. The only experience I have with it was when I checked it out about 6 years ago. Safe to say, I’m a n00b.
The problem is that I’m quite busy these days. Time and energy is not much for attempting learning a mammoth like Java.
Hello, Groovy! Groovy is a dynamic language specifically for the Java platform. Groovy is built for the JVM, making it easy for Java to integrate with Groovy vice versa. In Netbeans, they went a far as not even having an option to create a Groovy project. You create a normal Java project and then add Groovy classes to it. That is how tightly it seems integrated, which is good news for a n00b like me :)
The syntax itself seems very close to that of Ruby. Lets look at these examples (from the excellent article by Gerald Bauer – Groooooovy Babe: Jazzing Up Plain Old Java)
Here is some Java code
import java.util.*;
public class HelloWorld
{
public static void main( String args[] )
{
List country = new ArrayList();
country.add( "Canada" );
country.add( "Austria" );
country.add( "Brazil" );
Collections.sort( country );
for( Iterator it = country.iterator(); it.hasNext() )
System.out.println( "Hello " + it.next() );
}
}
The same in Groovy ( note the code reduction compared to Java :) )
country = [ 'Canada', 'Austria', 'Brazil' ]
country.sort
country.each { println "Hello ${it}" }
And in Ruby
country = [ 'Canada', 'Austria', 'Brazil' ]
country.sort
country.each { |country| puts "Hello #{country}" }
To top it all off, they even have their own Rails-like web framework called Grails (Groovy on Rails). I’ll check that out in due time.
All in all, Groovy feels much more comfortable and familiar to me. I’m looking forward to this little challenge and will probably write about it as I go along. Aslam Khan assured me that it is solid and he even have some Groovy code out there in the wild in production which is comforting! That and knowing someone who is an expert to ask for advice when the going gets rough, since I’m fairly sure it will get rough due to n00bn3ss!
I LOVE JAVA! that’s all I can say, I still use Netbeans whenever required, in my short career I’ve been forced to use other languages and technologies but my real love is with Java :)
Maybe now I can also start loving it ;)
yuk, java :). though groovy sounds like a really interesting project. maybe i will download and play with it.
i found this that might interest you sonar.codehaus.org. it is a code quiality management application. currently it only supports java and pl/sql langauges.
Dude, I felt the same way. Seriously, check out Groovy and let me know what you think. I think it is fantastic.
Only Java I know, is Mocca Java.
lol
I am doing java at school. I have to my matric final project due in a few months. Maybe I will check this out.
I’ve been playing around with groovy. All java programmers should take time to play with it. Did you knew that groovy is the #2 most important language for the JVM? (being java the #1). You probably will fall in love with the language very quickly.
I think I’m well on my way!
[...] is what happened to me on Twitter the other day. I was looking into the Groovy programming language and although Google returned a myriad of absolutely great results, it was not a quick answer to my [...]
what is the speed of Groovy codes compared to the speed of the java codes(which I am scared is already slow) ;). I used java for desktop apps for sometime then i decided to go web and took php. I love Java and the full OOP. the day I saw Groovy I thought it was wonderful but one drawback is I don’t have java web server. my company server is php and its affordable. maybe when I get a project that needs Java will hit Groovy and Grails instead of hibernate, Spring or Struts. which I found very complex to follow
PS: are you rebuilding afrigator.com in Java or just some extensions like crawling non rss sites, or its corporate secret ??