Programming Groovy 2 - book review
When I get the paperback copy of the "Programming Groovy 2" book back in the June 2017, I was wondering if I can find something new or exciting in the book that was written in July 2013. It took me almost 1,5 year before I have finally put the book on my desk and started reading and playing around with the examples. As a veteran Groovy developer, I have to say - it was worth it!
If I have to describe the book in only one sentence, I would say that "Programming Groovy 2" is the most pragmatic and gentle introduction to the Groovy programming language. Instead of explaining all possible features and use cases it focuses on the following major areas:
a practical introduction to the language,
using Groovy to solve day-to-day tasks,
experimenting with metaprogramming to get even more from the language.
What’s inside?
In the first part of the book, you will learn the differences between Groovy and Java. Reading this part of the book was more exciting back in the days before Java 8 because the concepts like closures or collections bulk operations had no equivalents in the raw Java language. However, it still contains a lot of important and interesting information, like dynamic typing or working with Groovy strings to name a few - something that any newcomer will appreciate and learn a lot from.
Part 2 focuses on the 3 practical use cases: working with XML files, connecting and querying the database, and using Groovy as a scripting language. It also covers one funny, at least for me use case - using Groovy SQL to query Excel document through JDBC interface. I was completely unaware that you can do something like that, I just never worked with Excel documents that way. It would save me much time if I knew that a few years earlier.
Part 3 introduces metaprogramming capabilities and shows various ways you can apply it for your own needs. Starting from simple method injection at the runtime, up to AST transformations applied during the code compilation phase. It explains in details Groovy’s MOP (meta-object protocol) layer, and if you ever wonder how does Groovy handle dynamic method invocation, the answer is here.
Part 4 closes the book with a few extensive examples of Groovy metaprogramming in action - builders, mocking and building DSLs. The previous part gives a solid foundation to understand the language’s dynamic nature and capabilities of MOP (and its limitations). The last part of the book puts everything into action making the story complete.
Who is this book for?
Venkat Subramanian has his unique and effective style of teaching. I’ve read "Programming Groovy 2" after spending 7 years with Groovy, and I still found it interesting and worth reading. The book aged gracefully and even though it covers Groovy version 2.1.1
, it is still the right choice to start a journey with Groovy with it. It covers fundamental language concepts that didn’t change much since 2013. So if you want to give Groovy a chance and you are looking for a practical guide - this book is definitely for you. Also, if you are already in the ecosystem and you want to improve your understanding of the language and its powerful features, you will also find "Programming Groovy 2" an exciting lecture. Tons of practical examples, very natural and smooth writing style, and a great learning experience - and all of it in a book with 300 pages. You can work it out in one weekend with the fast pace, or you can relax and split the experience into a several 1-hour long learning sessions. Whatever works for you best.
Programming Groovy 2: Dynamic Productivity for the Java Developer
You don’t have to leave the rich Java Platform to take advantage of Groovy. Groovy preserves Java’s semantics and extends the JDK, so programming in Groovy feels like the Java language has been augmented; it’s like working with a lighter, more elegant Java. If you’re an experienced Java developer who wants to learn how Groovy works, you’ll find exactly what you need in this book. (source: amazon.com)
Kindle EbookGet from amazon.comGet from amazon.caGet from amazon.deGet from amazon.co.ukGet from amazon.frGet from amazon.esBonus: how did I get my copy of the book?
I got my paperback copy in June 2017. I was lucky enough to draw a book prize during Toruń JUG Day event with Venkat Subramanian. It was the second time I had a pleasure to meet Venkat in person and spent time on talking not only programming related topics. It was such an excellent experience! Venkat is not only a great teacher but also one of the kindest person I have ever met in the tech industry.
0 Comments