Dr. Venkat Subramaniam is a well known speaker at the IT conference circuit, many of his talks present Groovy as the main topic. He recently published a book 'Programming Groovy" which looks to be a must read for everyone wanting to master Groovy metaprogramming. Continue reading to learn about Dr. Subramaniam's view on Groovy. Enjoy!
[img_assist|nid=2503|title=|desc=|link=none|align=right|width=139|height=202]Andres Almiray: Venkat, what got you into Groovy ?
Venkat Subramaniam: Very early in my career I realized that I will not be programming in the same language forever. Learning different languages changes your design perspective and also helps you with the language that you often use. Over the past two decades, I have enjoyed learning and practicing languages like C++, Java, C#, Ruby, ... and the productivity gains each of them bring along. So, I am pretty open and shameless when it comes to picking up languages. One thing that drew me into Groovy was the realization that I can take advantage of the productivity gains of dynamic languages at the same time benefiting from the powerful Java API and platform. I started using it for non-production code, little side projects, book keeping, administrative things that I have to do on a daily basis. I loved it and got hooked into it.
Andres: What do you consider to be Groovy's key strengths ?
Venkat: There are several things I like about Groovy. To me the key strengths are
- Metaprogramming with ease on the Java platform
- Flat learning curve and ease to intermix Java
- Better, lighter, fancier Java API
- Passionate Groovy community
Let me expand on those a bit. One of the real nice things I find in Groovy is its dynamic capabilities in the area of metaprogramming. You can easily use Aspects without loosing an arm and a leg. Building internal DSLs is real simple and easy. You can take advantage of built-in builders, etc. to gain productivity.
The flat learning curve is not something you can underestimate. If you are new to Groovy, you can start with Java code you're already familiar with in Groovy and refactor into a more Groovier code as you go along.
Several Java API have been made simpler and extended using concepts like closures. You will find the powerful JDK much more charming through the Groovy eyes and you will need fewer lines of code to get your work done. Your communication is less noisier and more effective.
I think one of the best things for Groovy is the passionate language designers and developers community around it. You can enjoy several good discussions, quick answers and fast fixes to issues. Overall, I am very pleased with the people who have gathered around Groovy in the past few years.
Andres: Conversely, what do you consider as Groovy's weak spots ?
Venkat: Let's call it areas of improvement. I really like Groovy and I think it will serve well the Java programmers deciding to take advantage of dynamic productivity on the Java platform. In order to meet that challenge I think the language designers need to step back a little bit and address consistency and ease of use. I think there are a few areas that need a bit more consistency in API and in implementation, especially two areas: preserving Java semantics and metaprogramming implementation. I discussed a few issues with the former in the "Groovy for the Java Eyes" chapter in "Programming Groovy" book. A few weeks ago Alexandru Popescu and I met in London and wrote a few suggestions on improving consistency in the area of metaprogramming and send it to Groovy designers for their review and consideration. We feel that these need to be addressed now as a number of Java developers begin to fully realize the potential and benefits of this really nice language.
Andres: Tell us more about your book, I understand is available now, right ?
Venkat: Yes, "Programming Groovy: Dynamic Productivity for the Java Developer" was published on April 9th, 2008 by Pragmatic Bookshelf. The book is intended for Java programmers to get up to speed on the strengths of Groovy. While it addresses general Groovy programming, I have devoted significant portion of material to metaprogramming in Groovy. There is also an emphasis on unit testing and what Groovy offers in that area. You can find more details at http://www.pragprog.com/titles/vslg.
Andres: What would you like to see in a future version of Groovy ?
Venkat: First, I like the language to address the consistency issues. Second would be performance, which I know is being addressed right now, so I am very optimistic about performance. Then, I think the focus can shift to adding more features without making it complex.
Andres: Agility and Groovy, does it make sense ?
Andres: Do you have a favorite technique when coding DSLs in Groovy ?
Venkat: Groovy is very suitable for implementing internal DSLs. I devote an entire chapter to this in the book. I really like how you can intermix the power of MetaClass and closures to implement some really sleek DSLs.
Andres: Do you have some tips for people starting with Groovy and testing ?
Venkat: Unit testing in Groovy has double bonus. First, you can use the techniques, tools, libraries, and frameworks already available in Java. Second, you can take advantage of the dynamic and metaprogramming capabilities of Groovy to help with testing. You can put the mock library, that is part of Groovy, to good use. This will help ease your unit testing of code with complex dependencies. Unit testing is one of the great ways to introduce Groovy on current projects, so it is a great way to get started with Groovy as well.
Andres: Any word of advice for people starting with Grails ?
Venkat: Just do it. Grails is a lot of fun. Grails is built using some well established Java frameworks, libraries and Groovy. Developers will find it very easy to use and it is a great tool for rapidly developing web applications. That can help a great deal with agility. I suggest starting with internal applications or prototyping if you have never used it. Once you get comfortable, you can move on to other applications.
Andres: How can developers sell Groovy/Grails to management ?
Venkat: I think the first step is to convince themselves. Rather than saying it is cool, show to yourself what real problems it solves and how. Once you can crystallize these solutions, not hypothetically, but using practical examples and prototypes related to your domain and application, you can show to your organization how these solve real problems. If you are thoroughly convinced, you will find ways to convince others. So, don't rely on infatuation, instead really on good information and knowledge.
Dr. Venkat Subramaniam, founder of Agile Developer, Inc., has trained and mentored thousands of software developers in the US, Canada, Europe, and Asia. Venkat helps his clients effectively apply and succeed with agile practices on their software projects. He is a frequent invited speaker at various international software conferences and user groups. He is author of .NET Gotchas (O’Reilly), coauthor of 2007 Jolt Productivity Award winning book “Practices of an Agile Developer” (Pragmatic Bookshelf), and author of “Programming Groovy” (Pragmatic Bookshelf).