A new version of the Groovy programming language aims to make life easier for programmers who work with Java and SQL, the language's developers note.
Last month SpringSource, a division of VMware, and the community of volunteer developers behind Groovy released a new version of the dynamically compiled language. New features include some old Java functionality that may help Java programmers work more easily with Groovy. It also includes some additions that ease the burden of working with SQL-based databases.
[ Keep up with app dev issues and trends with InfoWorld's Fatal Exception and Strategic Developer blogs. ]
Groovy is one of a a growing number of languages that run on Sun Microsystems' JVM (Java Virtual Machine).
Conceived in 2003, Groovy was developed as a Java-like language customized for tasks that Java itself fumbled at, such as XML parsing. Using Groovy, Java developers can work up scripts and codes without worrying about the sometimes considerable amount of boilerplate code that accompanies full-scale Java programs, said Guillaume Laforge, the head of Groovy development for SpringSource, a Java application infrastructure management software provider. By running on the JVM, Groovy can also use the myriad Java libraries that are available.
Laforge noted that since its formal introduction (version 1 wasn't released until 2007), Groovy has a found a niche in several different tasks, such as developing prototypes of Java programs. In conjunction with the Grails rapid development framework, it has also been used to quickly stand up and run database-driven Web applications.
Version 1.7 of the language includes a number of different features to help aid in these jobs, Laforge described.
One feature is support for anonymous inner classes and nested classes. Such support has long been available in Java, but earlier versions of Groovy eschewed them in favor of supporting a similar technique known as closures. Both approaches allow developers to code in such a way that it isn't necessary to write a new class for every possible business rule that the program may encounter. While the maintainers of Java are now considering the use of closures, Groovy will support the anonymous inner classes and nested classes so that Java programmers may more easily work with Groovy, Laforge said. This inclusion will also allow Java frameworks that rely heavily on anonymous inner classes to work more seamlessly with Groovy as well, he added.
Greater compatibility with SQL has been attempted with the new version of Groovy as well. Laforge noted that administrators have written Groovy scripts to migrate "big batches of data from one system to another," he said. A lot of traditional scripting languages don't work very well with SQL and writing a Java program for the task may be overkill. Groovy 1.7 features a new method that allows data to be moved by batches, which should simplify the writing of the migration scripts. It also features a similar method for transaction processing.







