Through the (ever increasingly more useful) Google+ I recently came across a post asking for reviews of ‘Getting Started with Google Guava’, and thought it’d be the perfect excuse I’ve been looking for to finally to start a tech blog (not to mention grabbing a free copy of a book!). In addition, I consider Guava an indispensable part of my developer toolset, and any chance to increase that understanding was more than welcome.
For those unaware of it, Guava is a set of libraries for the Java platform, developed by Google and used extensively within their codebase. The libraries cover a number of different areas, in particular collections (much of the code has been ported from the Google Collections Library), IO, string processing, caching and others. For me personally, I consider Guava a little like JodaTime, in that I could write Java without it but it’d be far more verbose and less legible, and for that reason it gets an automatic inclusion in the dependency list for any project I start.
The Guava documentation is, IMHO, pretty good, and the Guava explained section gives you an overview of what the various utilities set out to achieve directly from the developers, something that you can’t always see from a Javadoc. I was intrigued as to where the book would pitch itself given the information on the Guava site.
After an initial introduction to Guava itself, the book walks through key classes grouped by area (collections, functional programming etc), detailing what common problems they set out to solve and showing practical examples of how they might be used. In this regard it reads as somewhere between the ‘explained’ section mentioned above and the actual Javadocs, handily combined into one single place and written with the formality you would expect of a book.
The book content is for the most part at least as complete as the website information, and notably more in some cases (the chapters on ordering and concurrency in particular). My only minor gripe here is that the use of Optional and the need for the null object pattern is better explained in the official documentation. The e-version also has the major advantage of being commute friendly – I couldn’t imagine reading the website documentation on anything except a laptop screen or possibly a large tablet- whereas the Kindle version I had was perfect on the Nexus 7.
You can easily dip into the book as a reference when the website documentation doesn’t quite cut it. I read it start to finish – it doesn’t make for the most interesting read this way but I don’t think this is an issue with the style of writing, it simply comes from the fact that this is a book about utility libraries rather than say a framework where each chapter might conceivably build upon the chapters before it. Reading it start to finish rather than as a reference had the advantage that I read about parts of the library I hadn’t previously looked at that might be of use in future.
I found the chapters on caching, concurrency and events were a better read than the ones on collections, quite possibly because there is more content to them (there’s probably only so much you can say about a BiMap for example). I’d be tempted to say these would work better at the start of the book and the collections part pushed further down – some developers might prefer well written unit tests to explain the various collection classes and might not hold on for the better later chapters, which would be a shame given how informative they are.
The text was clear and concise and all the examples helpful. There were some key points in the ‘explained’ docs that I was happy to see emphasised in the book, in particular the warning about overuse of the functional idioms, which I something I’ve seen happen with developers when they are first introduced to Guava (myself included). I enjoyed reading this book and definitely feel it added to my understanding of the Guava libraries and I’d definitely recommend it to others as a great way of introducing yourself to such a powerful set of libraries.
Update: You can now find the book at http://www.packtpub.com/getting-started-with-google-guava/book, happy reading!