Groovy (programming language)

Groovy is a programming language and scripting language that supports dynamic and static typing. It is one of the languages ​​that run on the Java Virtual Machine, which allows availability for many platforms, especially Linux, Mac OS X and Windows. The design goal of the original developer, James Strachan was to combine a " polished " version of the Java syntax with the concepts of Ruby.

Groovy has some capabilities that are not present in Java: Closures, native syntax for Maps, lists and regular expressions, a simple template system that can be generated with the HTML and SQL code, a XQuery -like syntax for draining object trees, operator overloading and a native representation for BigDecimal and BigInteger.

Groovy is not like other scripting languages ​​running on an interpreted Abstract Syntax Tree, but before the expiration of a script translated directly into Java bytecode. Syntactically Groovy is much further away from Java as BeanShell, but much closer to Ruby and Python.

Groovy is used because of easy handling of BigDecimal, among others in the financial sector. Groovy is considered to be better integrated than most other scripting languages ​​on the JVM. This allows easy use of existing libraries or the use of Groovy objects and classes in Java.

The project was launched in 2003. Groovy was taken for standardization in 2004 as JSR 241 in the Java Community Process. The originally by James Strachan launched JSR is run by Guillaume Laforge, who is also project manager of the implementation project. James Strachan now considered Scala as better candidates for replacing Java. Long before the beginning of 2007 published version 1.0 of Groovy Strachan moved to ActiveMQ. Currently, Groovy version 2.2

For now exist Groovy plugins for Eclipse, IntelliJ IDEA, NetBeans, vim and emacs.

Example

The following compact Groovy script source code ( the script is exactly the same executable )

[" Rod ", " Carlos ", " Chris " ]. { Println it} each is semantically equivalent to about this Java code snippet, in which case the Java method missing in this code is executed.

For ( String it: new String [ ] { "Rod ", " Carlos ", " Chris "} )        System.out.println (it); In Groovy example, however, a list is used and in the Java snippet to an array.

280897
de