Over a million developers have joined DZone.

Paul King: Groovy and Agile

DZone's Guide to

Paul King: Groovy and Agile

· Java Zone ·
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

Paul King is known to the Groovy community as one of the coauthors of Groovy in Action and as an avid committer on the project, but he is also a regular speaker at conferences, lately focusing on testing and Agile methodologies. Continue reading to know Paul's thoughts on Groovy and Agile, a great match for the JVM. Enjoy!

Q. Pa[img_assist|nid=1859|title=|desc=|link=none|align=right|width=165|height=210]ul, what can you tell us about Groovy and Agile programming ?

A. Groovy helps with agility at a number of levels. One of the key benefits of agile is that as a developer you spend more time focussed on delivering customer value. Groovy allows you to write customer oriented acceptance tests (call them DSLs if you want) that assist the customer to understand and in many cases have more involvement with the development and testing activities.

Also, because you tend to write much less boiler plate code, you in turn spend more time writing code that actually corresponds to valuable business logic. Not only that, but the code is usually much easier to read, so as the system is evolved, much less time is needed in understanding what existing code is doing.

With its strong Java heritage and with design patterns built-in to the language in some cases or easy to add with low ceremony in other cases, you can easily avoid falling back to hacking which happens with some scripting languages. To put all this another way, you tend to be able to sustain high productivity and high quality with Groovy and this helps teams keep fast development cycles while retaining high quality, easy to understand code. Does that sound like agile heaven?

Also, Groovy makes it easy to make changes to systems. Its use of closures, builders, metaprogramming and categories provide you with a choice of techniques to assist making controlled or ad-hoc changes when and where required. This helps a team work in a light weight and iterative fashion and respond quickly to customer changes without compromising their code base quality. I am not saying all this comes for free with Groovy - just that Groovy as a language tends to help a team do these things - it's still hard work.

Groovy has also grown up in the era of unit testing, mocking, TDD, BDD and DSLs. So you will find excellent support for all of these built right in and if you don't like the built-in capabilities you can pick your favorite Java or Groovy library from the many that are available.

Finally, as far as how Groovy helps agility goes, Groovy can help ease some of the pain points that agile teams often face in the areas of testing and build files. Both of these areas are undergoing lots of activity at the moment so I expect we will see even more assistant to teams in this area in the future.

I guess the story goes the other way too. Agile helps Groovy in a number of ways. Although tool support has been coming on in leaps and bounds recently, tool support hasn't been as good in general for dynamic languages compared to statics ones. Using techniques like test first development and pair programming help provide you with the safety net you need to develop and refactor dynamic code with confidence.

Q. How did you get involved with Groovy ?

A. I was working with Dierk König on the WebTest web testing tool and it has some neat scripting language integration for various languages. Over time, it became obvious that Groovy integration worked better than the other scripting languages that WebTest supports. Once I started using Groovy in that context, it soon became obvious that it could be used in many more contexts.

Q. WebTest and Groovy sound right, tell us more!

A. WebTest is a framework for testing Web Applications. It builds upon HtmlUnit for its excellent Ajax and browser emulation support and adds excellent reporting as well as some innovative features like testing Excel spreadsheets and PDF documents if that is what your web application produces.

It is mostly driven by Marc Guillemot these days. Dierk and I (and others) help out whenever we can. WebTest comes in two flavors: an Ant flavor (testers less familiar with programming tend to like the XML nature of Ant) and Groovy (which lets you script away in Groovy using AntBuilder under the covers). Grails has a nice plugin to automatically generate tests for your boiler plate CRUD operations and you can easily extend those tests to produce a very nice acceptance test suite.

Q. Is there a feature you would like to see in a later version of Groovy ?

A. For me the number one feature I would like to see in 1.6 is Groovy's equivalent of Ruby's gems. So, the experimental Grapes module would be my pick. You can do everything already using Ivy or Maven yourself but it just isn't as nice as having a built-in 'package/module' management capability.

Apart from that, I mostly just want a little more speed, a little more consistency in some areas and on going improvements in the support for testing, for DSLs and for polyglot programming.

It might seem like I don't have a very big wish list, but there are three things which don't show up in my list so far. Firstly, there is a need to rework some of the internals to Groovy. This will be quite a lot of work but will help yield some of the speed improvements and put the language in a much better position for future evolution. Also, I expect to see many things happening in terms of libraries and frameworks available for Groovy - but mostly these won't require any changes to the language itself. Finally, I think there is a great opportunity to do more work on specifying parts of Groovy using tests. Some thought has been given to this topic in the past but we don't have much to show for it at the moment.

Q. Do you use Groovy at work ?

A. Yes, in my customer base, Groovy is becoming the second most common language in use by customers behind Java. This gives me plenty of opportunities for using Groovy. Until recently, Groovy was mainly used in specialized areas like testing, build scripts and business rules. The good news is that a second wave of adoption is now underway mainly due to Grails adoption which is leading to Groovy being used throughout entire applications. It is certainly an exciting time.

Q. What can you tell us about your experiences with Grails ?

A. I have been a keen user of Grails from its early days but it has only been in recent months (and the 1.0 release certainly helped) that my customer base has starting paying it really serious attention. We only have a few Grails applications in production so far but I expect that to be ramping up quickly over the next couple of years.

Thanks Paul!

Paul's bio

Paul King has broad experience in both technical and managerial roles across the telecommunications and information technology industries. He has a passion for innovation and often assists organizations in bringing new technologies or processes into their development practices. He has been contributing to open source projects for more than fifteen years, has contributed to international standards, has won prizes for his research, and is a frequent speaker at international conferences. His special interest areas are Java, Java EE, lightweight frameworks such as Spring, agile development, open source testing tools, XML and Web services, and dynamic languages such as Groovy. He is a Groovy committer and coauthor of Groovy in Action.

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}