Groovy
Image:Groovy groovy.png
Paradigm object-oriented, scripting
Appeared in 2003
Designed by JCP
Developer Guillaume Laforge (Project Manager and JSR-241 Spec Lead)
Latest release 1.5.7/ 09 October 2008; 43 days ago
Latest unstable release 1.6-beta-2/ 09 October 2008; 43 days ago
Typing discipline dynamic, strong, duck
Influenced by Python, Ruby, Perl, Smalltalk, Java
OS Cross platform (JVM)
License Apache License V2.0
Website http://groovy.codehaus.org

Groovy is an object-oriented programming language for the Java Platform as an alternative to the Java programming language. It is a dynamic language with features similar to those of Python, Ruby, Perl, and Smalltalk. It can be used as a scripting language for the Java Platform.

Groovy uses a Java-like curly bracket syntax which is dynamically compiled to Java Virtual Machine bytecodes and which works seamlessly with other Java code and libraries. The Groovy compiler can be used to generate standard Java bytecode to be used by any Java project. Most Java code is valid Groovy syntax and can be used dynamically as a scripting language.

Groovy is currently undergoing standardization via the Java Community Process under JSR 241. Groovy 1.0 was released on January 2, 2007.

Contents

Features

Groovy has a number of features not found in standard Java, including dynamic typing, closures and operator overloading.

Groovy's syntax is significantly more compact than Java. For example, a declaration in Standard Java 5+ such as:

public class StdJava
{
  public static void main(String argv[])
  {
    for (String it : new String [] {"Rod", "Carlos", "Chris"})
      if (it.length() <= 4)
        System.out.println(it);
  }
}

can be expressed in Groovy as:

 ["Rod", "Carlos", "Chris"].findAll{it.size() <= 4}.each{println it}

One noteworthy feature of Groovy is its native support for various markup languages such as XML and HTML, accomplished via an inline DOM syntax. This feature enables the definition and manipulation of many types of heterogeneous data assets with a uniform and concise syntax and programming methodology.[citation needed]

History

James Strachan first talked about the development of Groovy in his blog in August 2003. Several versions were released between 2004 and 2006. After the JCP standardization process began, the version numbering was changed and a version called "1.0" was released on Tuesday, January 2, 2007. After various betas and release candidates numbered 1.1, on December 7, 2007 Groovy 1.1 Final was released and immediately rebranded as Groovy 1.5 as a reflection of the great improvement made.

Integrated development environment

Many IDEs support Groovy.

Eclipse

IntelliJ IDEA

There are at least two plugins, but currently developed is the one released by JetBrains, Jet Groovy Plugin[1].

  • Code completion
    • You can complete Java code and Groovy code mutually. Not only you can complete Java classes from Groovy code, but also you can complete Groovy class from Java code in real time. You can mix Java and Groovy code in a project.
  • Jump to the definition by Ctrl with mouse click.
    • As same as completion, you can move between Java code and Groovy code.
  • Debugger
  • Quick-fix for coding errors.
  • Completions for GroovyDoc.
  • Refactoring such as extracting method.
  • Support for Grails and GSP.

NetBeans

Starting from version 6.5, NetBeans supports Groovy and Grails.

See also

References

External links

Look up groovy in Wiktionary, the free dictionary.

No comments have been added.



Your name:

City:

Country:

Your comments:

Security check *
(Please enter the number into adjoining box)