- Groovy (programming language)
Infobox programming language
name = Groovy
paradigm = object-oriented, scripting
year = 2003
designer = JCP
developer = Guillaume Laforge (Project Manager and JSR-241 Spec Lead)
latest_release_version = 1.5.7
latest_release_date = release date|2008|10|09
latest_test_version = 1.6-beta-2
latest_test_date = release date|2008|10|09
typing = dynamic, strong, duck
influenced_by = Python, Ruby,
Perl, Smalltalk, Java
license = Apache License V2.0
website = http://groovy.codehaus.org
Groovy is an object-oriented
programming languagefor the Java Platformas 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 languagefor the Java Platform.
Groovy uses a Java-like curly bracket
syntaxwhich is dynamically compiled to Java Virtual Machine bytecodes and which works seamlessly with other Java code and libraries. The Groovy compilercan be used to generate standard Java bytecodeto be used by any Java project. Most Java code is valid Groovy syntaxand can be used dynamically as a scripting language.
Groovy is currently undergoing
standardizationvia the Java Community Processunder [http://www.jcp.org/en/jsr/detail?id=241 JSR 241] . Groovy 1.0 was released on January 2, 2007.
Groovy has a number of features not found in standard Java:
The following presents a side-by-side comparison ofJava with Groovy:
Standard Java (Java 5+)
Mark-up language support
One noteworthy feature of Groovy is its native support for various
markup languages such as XMLand 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. For example:
the following Groovy code ...
... produces the XML result:
For the sake of comparison, Java code to produce the equivalent XML is shown below. Note that, unlike the Groovy example, each XML element and attribute is created with an explicit method call.
equivalent Java code:
James Strachan first talked about the development of Groovy in his [http://radio.weblogs.com/0112098/2003/08/29.html 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 2007Groovy 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 =
* Methods are completed, if you specify the type of variables.
* Update site is http://dist.codehaus.org/groovy/distributions/update/
There are at least two plugins, but currently developed is the one released by JetBrains, Jet Groovy Plugin [http://www.jetbrains.com/idea/features/groovy_grails.html] .
* 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.
* Quick-fix for coding errors.
* Completions for GroovyDoc.
* Refactoring such as extracting method.
* Support for Grails and GSP.
Starting from version 6.5, NetBeans supports Groovy and Grails.
Comparison of programming languages
* [http://groovy.codehaus.org/ Official site]
* [http://www.jcp.org/en/jsr/detail?id=241 JSR 241]
* [http://www-128.ibm.com/developerworks/java/library/j-alj08034.html An introduction to Groovy]
* [http://dmoz.org/Computers/Programming/Languages/Java/Extensions/Groovy/ Open Directory: Java: Extensions: Groovy]
* [http://groovy.codehaus.org/Groovy+for+the+Office Groovy for the Office]
* [http://groovy.dzone.com/ Groovy Zone - DZone Groovy news aggregator]
Wikimedia Foundation. 2010.