Book Review:Groovy Recipes: Greasing the Wheels of Java
Buy it now
One Minute Bottom Line
The material in this book is very well organized for random access. Each and every chapter, and every section in each chapter is organized in such a way that it solves a specific problem or explains with excellent working examples some specific Groovy language feature.
For those who prefer a more text bookish approach, there is always the ultimate guide for Groovy, "Groovy in Action" book; but if you like to work out real world examples as you read, this is the book you need to buy.
Chapter 1, Introduction, as the name implied introduces you to Groovy, and also gives a road map of what you will be reading in this book.
Chapter 2, Getting Started, shows you how to install Groovy, running a Groovy Script, compiling Groovy code. This chapter also discusses two commonly used tools that come with the Groovy, which also provide the ability to execute Groovy commands interactively: the Groovy shell, and the Groovy console.
Finally, how to use Groovy with various IDE’s like Eclipse, IntelliJ IDEA and any other editor of your choice are explored.
Chapter 3, New to Groovy, discusses the most powerful features of Groovy like; duck typing, Groovy truth, closures, and many useful features with examples which you can work on as you read this chapter.
Chapter 4, Java and Groovy Integration explores how groovy can be integrated with an existing Java infrastructure. Calling Groovy from Java is explored, as well as calling Java from Groovy. This naturally leads to the discussion of the Groovy joint compiler, the ability to easily compile Java and Groovy code using a single command.
A brief discussion of compiling your project with Ant and Maven concludes this chapter.
Chapter 5, Groovy from the Command line. One of the easiest ways to learn Groovy language is to use the command line. And this is exactly where this chapter takes you.
Chapter 6, File Tricks discusses the different ways you can use Groovy to work with the file system; listing files in a directory, reading files, copying them. Using the AntBuilder to copy a file or a directory, moving and renaming files and also zipping and unzipping files are presented as well.
Chapter 7, Parsing XML, explores Groovy’s support to XML and also how easy it is to work with XML using Groovy. These include using Groovy's XMLParser and XMLSlurper classes, understanding the difference between them.
Chapter 8, Writing XML. The previous chapter explored different ways to consume XML, this chapter as the name indicates, discusses the different ways to write XML using MarkupBuilder and StreamMarkupBuilder.
Chapter 9, Web Services. The chapter begins with a brief discussion of how to find out your local IP address and name, as well of those on remote systems. Next few sections are focused on HTTP. The last few sections explore making SOAP calls, RESTful calls, XML-RPC calls, and much more.
Chapter 10, Metaprogramming. To quote from the book” Metaprogramming is writing code that has the ability to dynamically change its behavior at runtime”.
This chapter discusses the many ways to programmatically find what fields and methods a class has, add new fields and methods at runtime using the MetaClass class. The chapter also explores calling methods that don’t exist using the invokeMethod(). I assure you, this is the chapter which will show you how fun and powerful Groovy is.
Chapter 11, Working with Grails, presents Grails, a web application framework that is built around Groovy. The chapter discusses installing Grails, creating Grails application, and understanding the Grails environments. The chapter next explores how to customize your Grails application by showing how to change the database, the home page.
The last few sections explain what are Controllers and Views, what scaffolding is, validation your data. Finally, the chapter ends with discussion about managing table relationships and mapping classes to legacy databases.
Chapter 12, Grails and Web Services. If you want to know more about how to use your Grails framework with RESTful web services, JSON web services, Atom feeds, podcast feeds, this chapter gives you a brief overview for all the above.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)