Groovy is a scripting language designed to augment the Java. Its compatible with Java in byte code level, in syntax level, it provide much more flexible than Java like weak type, closure, functional programming.

In general, scripting languages are higher in abstraction level , thus more expressive. It makes the developer can iterate rapidly and boost productivity. Its very easy to manipulate complex component in scripting language. They are not designed to implement the complex components.

Weak type

Most scripting language are weakly typed , also called dynamic type. System language like Java and C++ have strong type, each variables must has a type and be used in a particular way. Strong types make the code more robust and safe. But this makes it difficult to connect components together because before calling the component , you need to know the accurate type information about the component.

Scripting language are weakly typed, the type checking happens at runtime. Its the developers's responsibility to make sure the variables are used properly, for example a function accept an integer, developer has to make sure not pass a string to the function.

With a good unit testing practice, the drawbacks of weak type can be alleviated.

Groovy and Java

Groovy in its nature, is Java. Groovy compiler and Java compiler generate the same byte code that can run in a JVM. All kinds of Java library and tool kit are immediately available in Groovy.

Everything in Groovy are objects, unlike Java which contains primitive types. The type is the object itself , not the variable reference to the object. Groovy is much like Python, Ruby or Javascript.

The common data structures like Map, List are built in for the language. Iteration on these data structures is done by the closure, like the anonymous function in Javascript.

Define a map with nested map:

def map = [ 'title' : 'This is title', 'message' : 'This is message', 'authors' : ['author1' : 'Ken' , 'author2' : 'Joe'] ]

Being agile on Java platform

Java is an old language which dominate the server side platforms. It becomes more and more like a new COBOL, at the same time, the agile platforms like Ruby, LAMP even .NET draws more and more attention because of the flexible and productive language. There are a lot of effort has been devoted to introduce languages like Ruby, Python, Javascript to run on JVIM as the replacement of Java. One of the best is Groovy.

It keeps the good part of Java platform and the API, and absorbed the beneficial part of agile platform.