FACTOID # 117: In Germany and Italy, every second person owns a car.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Groovy (programming language)
Groovy
Paradigm: object-oriented, scripting
Appeared in: 2003
Designed by: JCP
Typing discipline: dynamic, strong
Influenced by: Python, Ruby, Perl, Smalltalk, Java

Groovy is an object-oriented programming language for the Java Platform as an alternative to the Java programming language. It can be viewed as a scripting language for the Java Platform, as it has features similar to those of Python, Ruby, Perl, and Smalltalk. In some contexts, the name JSR 241 is used as an alternate identifier for the Groovy language. A programming paradigm is a paradigmatic style of programming (compare with a methodology, which is a paradigmatic style of doing software engineering). ... Object-oriented programming (OOP) is a programming paradigm that uses objects and their interactions to design applications and computer programs. ... Scripting languages (commonly called scripting programming languages or script languages) are computer programming languages that are typically interpreted and can be typed directly from a keyboard. ... Year 2003 (MMIII) was a common year starting on Wednesday of the Gregorian calendar. ... The Java Community Process or JCP, established in 1995, is a formalized process which allows interested parties to be involved in the definition of future versions and features of the Java platform. ... In computer science, a type system defines how a programming language classifies values and expressions into types, how it can manipulate those types and how they interact. ... In computer science, a type system defines how a programming language classifies values and expressions into types, how it can manipulate those types and how they interact. ... In computing, strongly-typed, when applied to a programming language, is used to describe how the language handles datatypes. ... Python is a high-level programming language first released by Guido van Rossum in 1991. ... Ruby is a reflective, dynamic, object-oriented programming language. ... Wikibooks has a book on the topic of Perl Programming Perl is a dynamic programming language created by Larry Wall and first released in 1987. ... For other uses, see Small talk. ... “Java language” redirects here. ... Object-oriented programming (OOP) is a programming paradigm that uses objects and their interactions to design applications and computer programs. ... A programming language is an artificial language that can be used to control the behavior of a machine, particularly a computer. ... The Java platform is the name for a bundle of related programs, or platform, from Sun Microsystems which allow for developing and running programs written in the Java programming language. ... “Java language” redirects here. ... Scripting languages (commonly called scripting programming languages or script languages) are computer programming languages that are typically interpreted and can be typed directly from a keyboard. ... Python is a high-level programming language first released by Guido van Rossum in 1991. ... Ruby is a reflective, object-oriented programming language. ... Wikibooks has a book on the topic of Perl Programming Perl is a dynamic programming language created by Larry Wall and first released in 1987. ... For other uses, see Small talk. ...


Groovy uses a Java-like curly bracket syntax which is dynamically compiled to JVM bytecodes and that 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 or it can be used dynamically as a scripting language. Curly brace or bracket programming languages are those which use balanced brackets ({ and }, also known as brace brackets or simply braces) to make blocks in their syntax or formal grammar, mainly due to being C-influenced. ... For other uses, see Syntax (disambiguation). ... A Java Virtual Machine (JVM) is a set of computer software programs and data structures which implements a specific virtual machine model. ... Bytecode is a binary representation of an executable program designed to be executed by a virtual machine rather than by dedicated hardware. ... Illustration of an application which may use libvorbisfile. ... A diagram of the operation of a typical multi-language, multi-target compiler. ... Java bytecode is the form of instructions that the Java virtual machine executes. ... Scripting languages (commonly called scripting programming languages or script languages) are computer programming languages that are typically interpreted and can be typed directly from a keyboard. ...


Groovy is currently undergoing standardization via the Java Community Process under JSR 241. Groovy 1.0 was released on January 2, 2007. Groovy 1.1 is currently in beta and supports Java 5 annotations and static imports. “Standard” redirects here. ... The Java Community Process or JCP, established in 1995, is a formalized process which allows interested parties to be involved in the definition of future versions and features of the Java platform. ... is the 2nd day of the year in the Gregorian calendar. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st Century. ...

Contents

Language Features

Groovy has a number of features not found in standard Java:

On computer science, a datatype (often simply type) is a name or label for a set of values and some operations which can be performed on that set of values. ... In computer science, a type system defines how a programming language classifies values and expressions into types, how it can manipulate those types and how they interact. ... Look up list in Wiktionary, the free dictionary. ... An associative array (also map, hash, dictionary, finite map, lookup table, and in query-processing an index or index file) is an abstract data type composed of a collection of keys and a collection of values, where each key is associated with one value. ... A regular expression (abbreviated as regexp, regex or regxp) is a string that describes or matches a set of strings, according to certain syntax rules. ... In computer science, a closure is a function that is evaluated in an environment containing one or more bound variables. ... In computer programming, operator overloading (less commonly known as operator ad-hoc polymorphism) is a specific case of polymorphism in which some or all of operators like +, = or == have different implementations depending on the types of their arguments. ...

Syntax Comparison

The following presents a representative side-by-side comparison of Java with Groovy:


Standard Java (Java 5+)

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

Groovy

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

Markup Language Support

One noteworthy feature of Groovy is its native support for various markup languages such as XML and HTML. This feature enables the definition and manipulation of many types of heterogeneous data assets with a uniform syntax and programming methodology. For example: A specialized markup language using SGML is used to write the electronic version of the Oxford English Dictionary. ... The Extensible Markup Language (XML) is a general-purpose markup language. ... HTML, short for Hypertext Markup Language, is the predominant markup language for web pages. ...


the following Groovy code ...

 import groovy.xml.MarkupBuilder def myXMLDoc = new MarkupBuilder() myXMLDoc.workbook { worksheet(caption:"Employees") { row(fname:"John", lname:"McDoe") row(fname:"Nancy", lname:"Davolio") } worksheet(caption:"Products") { row(name:"Veeblefeetzer", id:"sku34510") row(name:"Prune Unit Zappa", id:"sku3a550") } } println myXMLDoc 

... produces the XML result:

 <workbook> <worksheet caption='Employees'> <row fname="John" lname="McDoe" /> <row fname="Nancy" lname="Davolio" /> </worksheet> <worksheet caption='Products'> <row name="Veeblefeetzer" id="sku34510" /> <row name="Prune Unit Zappa" id="sku3a550" /> </worksheet> </workbook> 

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.


See also

Boo is an object oriented, statically typed programming language developed starting in 2003, which seeks to make use of the Common Language Infrastructure support for Unicode, globalization and web style applications, while using a Python-inspired syntax and a special focus on language and compiler extensibility. ... Java Tcl, abbreviated as JACL, is a Java-based, open source, implementation of the Tcl scripting language. ... JRuby is a Java implementation of the Ruby interpreter, being developed by the JRuby team. ... Jython, formerly known as JPython, is an implementation of the Python programming language written in Java. ... BeanShell is a Java scripting language, invented by Pat Niemeyer. ... Grails is an open source web application framework for high productivity. ... Scala is a multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way. ... Wikibooks has more about this subject: Curl The Curl programming language (unrelated to cURL) is a reflective programming language designed to create interactive web content. ... REBOL, the Relative Expression Based Object Language (pronounced [rebl]), is a data exchange and programming language designed specifically for network communications and distributed computing. ...

References

  • Koenig, Dierk; Andrew Glover, Paul King, Guillaume Laforge and Jon Skeet (2006). Groovy in Action. Manning. ISBN 1-932394-84-2. 
  • Barclay, Kenneth; John Savage. Groovy Programming: An Introduction for Java Developers. ISBN 978-0-12-372507-3. 
  • Groovy Recipes: Greasing the Wheels of Java. ISBN 978-0978739294. 

External links

Look up groovy in Wiktionary, the free dictionary.

  Results from FactBites:
 
The Java Community Process(SM) Program - JSRs: Java Specification Requests - detail JSR# 241 (1243 words)
Groovy is a complement of the Java programming language, not a replacement of it.
Groovy is a very "learnable" programming language that makes adoption of the Java platform by developers go more quickly and smoothly.
Groovy can be a low-threshold language for developers new to the Java platform as well as a productivity-enhancing tool for experienced Java developers.
A Crash Overview of Groovy (1730 words)
Scripting languages allow for light-weight programs that are often quick and easy to write, which makes writing a script more attractive than writing a full-fledged program for some common tasks; however, there are times when we want the convenience of a scripting language without giving up the features of a programming language.
Groovy is "an agile dynamic language for the Java 2 Platform" [1] that attempts to combine the convenience of scripting with the functionality of Java.
Groovy does not provide the arbitrary operator overloading that lends itself to abuse in C++ but pairs nineteen common operators to method names so that using an operator will have the same effect as a method call with the corresponding name [2].
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.