Well, this was about time:
TL;DR: There's a little book about Guava out. I've had a quick look through it and it looks mighty fine.
Earlier this week I got an offer to review this new book on Google Guava. For those of you who don't know Guava, I dare say it is the finest utility tool-belt library available for Java development.
The author, Bill Bejeck, hasn't been involved with the development of Guava, but he has blogged some articles on the subject in the past. What I've read so far in the book speaks that he knows what he's talking about.
What you can do instead, for starters, is to read through the GuavaExplained wiki pages, which offer a much nicer reading experience, but go into very little detail.
So then you're left with looking through some presentations/slides from the authors, which are not really meant for being read, or you look through some of the articles and blog-posts scattered around the net (I used to collect them all here, but I left it behind at some point. Maybe I should put the list on GitHub instead soon).
The problem with any given article of Guava is that it focuses on just a few things. Usually something with the collections, filtering and ordering. Not many articles go into for example concurrency, or file IO, and none of them cover everything.
When facing some programming challenge, you often don't know whether it is somehow solved within Guava, or whether it can be solved with the help of Guava. So you start looking for it. If you're lucky, the words you choose to search for are coincidentally used in a post on StackOverflow, but often you end up scurrying around in the Guava JavaDocs not knowing in which class your desired utility is located.
Solution: This book gives you a terse but elaborate tour of all the most important sides of Guava. It gives you knowledge of a lot of great features, and gives you many ideas of what other things you should look for in Guava when facing some problem.
I'm not going to duplicate the table of contents here, just head over to the book homepage and see the respective tab there. Apart from covering the Guava basics for Strings, objects, collections, streams and IO, there are some really interesting advanced sections on caching, concurrency and event-based programming (the EventBus class). I'm looking forward reading these parts more thoroughly over the next weeks.
One downside of the book is that it's arriving very near to the time where we will finally get lambdas into Java with Java 8. Don't be alarmed though, the book will still be useful. Actually, closures in Java are an excellent fit for Guava's functions, and will make them much easier to write and read. The author himself explains how this works out in this blog-post. So it's a bit of a pity that the book wasn't able to make use of the new syntax. Perhaps he will publish a Java 8 version of the code examples in the future (natch, natch)?
Another thing mentioned in the book is Guava's Optional type, but there is no discussion on this versus the Optional type coming with Java 8. Another thing I missed was a mention of the Throwables.propagate methods, which are great for quickly dealing with checked exceptions, but then again, there are limits to what you can cover in a book of roughly 100 pages.
Some of the code examples get some indenting and line breaks wrong, but maybe this is a common problem with programming eBooks these days. I mean, why is there no colored syntax highlighting for code in eBooks? In any case, once you buy the book you can download all the sample code from every chapter that are ready to build with both Maven and Gradle.
Google Guava at PacktPub |
Earlier this week I got an offer to review this new book on Google Guava. For those of you who don't know Guava, I dare say it is the finest utility tool-belt library available for Java development.
The author, Bill Bejeck, hasn't been involved with the development of Guava, but he has blogged some articles on the subject in the past. What I've read so far in the book speaks that he knows what he's talking about.
Why do you need a book about Guava?
Now, Guava is a library where you can only fully immerse yourself by reading through all of the JavaDoc, and in the first few rounds of doing so you probably won't understand half of it.What you can do instead, for starters, is to read through the GuavaExplained wiki pages, which offer a much nicer reading experience, but go into very little detail.
So then you're left with looking through some presentations/slides from the authors, which are not really meant for being read, or you look through some of the articles and blog-posts scattered around the net (I used to collect them all here, but I left it behind at some point. Maybe I should put the list on GitHub instead soon).
The problem with any given article of Guava is that it focuses on just a few things. Usually something with the collections, filtering and ordering. Not many articles go into for example concurrency, or file IO, and none of them cover everything.
When facing some programming challenge, you often don't know whether it is somehow solved within Guava, or whether it can be solved with the help of Guava. So you start looking for it. If you're lucky, the words you choose to search for are coincidentally used in a post on StackOverflow, but often you end up scurrying around in the Guava JavaDocs not knowing in which class your desired utility is located.
Solution: This book gives you a terse but elaborate tour of all the most important sides of Guava. It gives you knowledge of a lot of great features, and gives you many ideas of what other things you should look for in Guava when facing some problem.
Inside the book
Just to put it into perspective. I've been using Guava since 2010, and only half-way through the book it turned to things I'm still unfamiliar with. Already in the first chapter I discovered new things about the Joiner and Splitter I wasn't aware of.I'm not going to duplicate the table of contents here, just head over to the book homepage and see the respective tab there. Apart from covering the Guava basics for Strings, objects, collections, streams and IO, there are some really interesting advanced sections on caching, concurrency and event-based programming (the EventBus class). I'm looking forward reading these parts more thoroughly over the next weeks.
One downside of the book is that it's arriving very near to the time where we will finally get lambdas into Java with Java 8. Don't be alarmed though, the book will still be useful. Actually, closures in Java are an excellent fit for Guava's functions, and will make them much easier to write and read. The author himself explains how this works out in this blog-post. So it's a bit of a pity that the book wasn't able to make use of the new syntax. Perhaps he will publish a Java 8 version of the code examples in the future (natch, natch)?
Another thing mentioned in the book is Guava's Optional type, but there is no discussion on this versus the Optional type coming with Java 8. Another thing I missed was a mention of the Throwables.propagate methods, which are great for quickly dealing with checked exceptions, but then again, there are limits to what you can cover in a book of roughly 100 pages.
Reading experience
I got the .epub version on my Android tablet, and the best reading experience was in Google Play Books where there was some coloring of headings, and source code was different color from the text of the book.Some of the code examples get some indenting and line breaks wrong, but maybe this is a common problem with programming eBooks these days. I mean, why is there no colored syntax highlighting for code in eBooks? In any case, once you buy the book you can download all the sample code from every chapter that are ready to build with both Maven and Gradle.
Summary
This is a great and important little guide with little competition. It delivers on the whole "Getting Started" premise really well in quite few pages, and works well as both a reference to have around when programming Java, and as a thorough read of getting into what Guava is about. Well done!
Comments
Post a Comment