|
Groovy is an object-oriented programming language designed for the Java platform as an alternative to Java with features from Python, Ruby and Smalltalk. Wikipedia does not have an article with this exact name. ...
Logo en:Wiktionary Wiktionary is a sister project to Wikipedia intended to be a free wiki dictionary (including thesaurus and lexicon) in every language. ...
Object-oriented programming (OOP) is a computer programming paradigm in which a software system is modeled as a set of objects that interact with each other. ...
A programming language or computer language is a standardized communication technique for expressing instructions to a computer. ...
The Java platform is the name for a computing environment, or platform, from Sun Microsystems which can run applications developed using the Java programming language and set of development tools. ...
Java is an object-oriented programming language developed initially by James Gosling and colleagues at Sun Microsystems. ...
Python is an interpreted programming language created by Guido van Rossum in 1990. ...
Ruby is a reflective, object-oriented programming language. ...
Smalltalk is an object-oriented, dynamically typed, reflective, programming language designed at Xerox PARC by Alan Kay, Dan Ingalls, Ted Kaehler, Adele Goldberg, and others during the 1970s, influenced by Sketchpad and Simula. ...
Groovy uses a Java-like syntax which is dynamically compiled to JVM bytecodes and that works seamlessly with other Java code and libraries. The Groovy compiler can be used as an alternative to javac to generate standard Java bytecode to be used by any Java project or it can be used dynamically as a scripting language. Syntax, originating from the Greek words ÏÏ
ν (syn, meaning co- or together) and ÏÎ¬Î¾Î¹Ï (táxis, meaning sequence, order, arrangement), can be described as the study of the rules, or patterned relations that govern the way the words in a sentence come together. ...
A Java Virtual Machine or JVM is a virtual machine that runs Java byte code. ...
Byte-code is a sort of intermediate code that is more abstract than machine code. ...
Illustration of an application which may use libvorbisfile. ...
A diagram of the operation of a typical multi-language compiler. ...
In computing, a Java compiler is a computer program that translates programs in Java to Java byte-code. ...
Scripting languages (commonly called scripting programming languages or script languages) are computer programming languages initially designed for scripting the operations of a computer. ...
Groovy is currently undergoing standardization through the Java Community Process with the JSR 241. Standardization, in the context related to technologies and industries, is the process of establishing a technical standard among competing entities in a market, where this will bring benefits without hurting competition. ...
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. ...
Groovy has a number of features not found in standard Java: - Dynamic "duck" typing
- Native syntax for lists, maps, arrays, and regular expressions
- Closures
- Operator overloading
Examples class Foo { def doSomething() { def data = ["name": "James", "location": "London"] for (e in data) { println("entry ${e.key} is ${e.value}") } } def closureExample(collection) { collection.each { println("value ${it}") } } static void main(args) { def values = [1, 2, 3, "abc"] def foo = new Foo() foo.closureExample(values) foo.doSomething() } } Comparison between Java code and comparable Groovy code JAVA: public class Filter { public static void main( String[] args ) { List list = java.util.Arrays.asList( "Rod", "James", "Chris" ); Filter filter = new Filter(); List shorts = filter.filterLongerThan( list, 4 ) for ( String item : shorts ) { System.out.println( item ); } } public List filterLongerThan( List list, int length ) { List result = new ArrayList(); for ( String item : list ) { if ( item.length() <= length ) { result.add( item ); } } return result; } } GROOVY: list = ["Rod", "James", "Chris"] shorts = list.findAll { it.size() <= 4 } shorts.each { println it } External links |