Weekly Edition Return to the Development page |
Groovy, a Java-like Scripting Language
Groovy is a relatively
new scripting language that resembles Java, it is built on top of
the Java Virtual Machine (JVM).
The main developers are James Strachan and Bob McWhirter.
Groovy is a new agile dynamic language for the JVM combining lots of great features from languages like Python, Ruby and Smalltalk and making them available to the Java developers using a Java-like syntax.
Groovy is designed to help you get things done on the Java platform in a quicker, more concise and fun way - bringing the power of Python and Ruby inside the Java platform.
Some of the basic features of Groovy include:
If you are interested in learning more about Groovy, take a look at Andrew Glover's introductory article on IBM's developerWorks entitled Feeling Groovy. (Log in to post comments)
The attitude to licenses is telling Posted Aug 5, 2004 10:59 UTC (Thu) by angdraug (subscriber, #7487) [Link] From the FAQ: Groovy is open source using a BSD / Apache style licence The link returns 404: The resource you requested cannot be found. So, what exactly kind of BSD/Apache license is used by Groovy?
The attitude to licenses is telling Posted Aug 5, 2004 12:23 UTC (Thu) by hummassa (subscriber, #307) [Link] /*$Id: LICENSE.txt,v 1.2 2003/09/26 17:36:36 jstrachan Exp $
Copyright 2003 (C) James Strachan and Bob Mcwhirter. All Rights Reserved.
Redistribution and use of this software and associated documentation
1. Redistributions of source code must retain copyright
2. Redistributions in binary form must reproduce the
3. The name "groovy" must not be used to endorse or promote
4. Products derived from this Software may not be called "groovy"
5. Due credit should be given to The Codehaus -
THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS
*/
Groovy, a Java-like Scripting Language Posted Aug 5, 2004 21:53 UTC (Thu) by jonabbey (subscriber, #2736) [Link] This looks very nice, indeed. We're working on integrating Jython into our app, but Groovy might make an attractive alternative.
Groovy, a Java-like Scripting Language Posted Aug 6, 2004 2:22 UTC (Fri) by yanfali (subscriber, #2949) [Link] I'm an intermediate Java programmer and a competent script writer (bash, tcl, and ruby mostly), so here's my experience with groove.
I wrote a simple script to automagically backup a mysql db in it just to test how easy it was to write stuff versus say bash or ruby. It ain't pretty. Firstly, it's well documented from an API point of view but there are almost no examples on the website beyond trivial code.
Secondly, it's obviously early. The release says beta, and two things stick out like sore thumbs:
1. debugging is really quite unclear for anything beyond simple brackets because it spits out full Java Exceptions which you have to parse rather than tell you the line number and what it thinks went wrong; it's in there but you have to dig.
2. there's a distinct lack of convenience libraries. The real power behind most scripting languages isn't the syntax it's the libraries that have been implemented that make them useful. Just look at Python, Perl and Ruby. The libraries are really what make you want to use it.
At this point, groove is a *great* start, but until it has the breadth of library functions of something like Ruby it's a bit of a pain to use for general scripting. Yes you can use all the Java classes and that's great, but it also means you have to start structuring your script like a Java program which defeats the point of using a scripting language in the first place.
I think the niche uses of JUnit testing and Ant are where it will get it's initial traction and that's not necessarily a bad thing.
For example, here's how I got a simple formatted date out of groove
year = calendar.get(Calendar.YEAR)
#Force to String to Keep Leading Zero
return amonth + "_" + aday + "_" + ayear
It's basically weakly-typed Java. A better way would be for me to have some sort of convenience method that parsed say a unix 'date' style string and returned a formatted date string; I guess I'll have to write it myself :) Over time I'm sure the issue of helper methods will be sorted out and I look forward to future releases, but right now it's frustrating.
On the plus side, the great things that stand out are autoboxing of variables, much more relaxed syntax and useful constructs for looping across objects. With time I think this will become a useful tool in the arsenal of any Java developer. I think it would be great if they could set up a cookbook on the codehaus website with recipes, this would ease the learning curve enormously and help build a community spirit.
|
Copyright © 2004, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.