Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Using Groovy To Write Less Code

Using Groovy To Write Less Code

In a new IBM DeveloperWorks article, Scott Hickey compares writing code in Java versus Groovy. He finds that Groovy allows developers to focus more time writing algorithms and less time focusing on language semantics. In his first example a 60+ line JavaBean from Spring: A Developer's Notebook becomes a 24 line GroovyBean. An example focusing on testing shows how's Groovy's support for flexible constructors and setting object properties reduces code noise.  Many Java developers advocate writing unit tests in Groovy.  While organizations often have restrictions on production code, they don't have similar requirments on test cases.  The article also features examples in regards to polymorphism and Spring.

Rate this Article