background preloader

Groovy

Facebook Twitter

Taking reuse to the next level with closures. This article is about how to take reuse to the next level by using Groovy's closure language feature to aid in reuse, intercept method calls and even replace methods at runtime. Then we discuss the true nature of closures. A closure is an executable block of code, similar to an anonymous method, but it can be treated like an object reference. It follows a lot of the same rules as an anonymous inner class in Java. Throughout this article closures true nature will be revealed.

In the last article we used invokeMethod and idiomatic method invocation with strings to garner another level of reuse. In this article we will do the same but with Groovy closures. Using closures is essential to understanding Groovy as the GDK uses closures extensively. In the last article we showed a simple example which was a Computer class that was using the Observer/Observable design pattern to notify interested third parties that a rent event occurred. RentableEvent that extends java.util.EventObject 2. 04. 23. What's New in Groovy 1.6. Groovy is a very successful and powerful dynamic language for the Java Virtual Machine that provides seamless integration with Java, and has its roots firmly planted in Java itself for the syntax and APIs and other languages such as Smalltalk, Python or Ruby for its dynamic capabilities.

Groovy is used in many Open Source projects such as Grails, Spring, JBoss Seam and more, as well as integrated in commercial products and Fortune 500 mission-critical applications for its scripting capabilities offering a nice extension mechanism to these applications, or for its ability to let subject matter experts and developers author embedded Domain-Specific Languages to express business concepts in a readable and maintainable fashion. In this article, Guillaume Laforge, Groovy Project Manager and Head of Groovy Development at SpringSource, will go through an overview of the novelties offered by the newly released Groovy 1.6.

Overview of Groovy 1.6 Performance improvements Multiple assignments @Lazy. Broadway-monitor - Google Code. Practically Groovy: JDBC programming with Groovy. DeveloperWorks : practically Groovy.