I didn't have much time to write posts recently (beacuse of work and my book "Mockito Instant") but I came across Bill Bejeck's book entitled "Getting Started with Guava". After having read it I decided that I will try also to blog about computer science related books. So without any futher ado let's move to the review :)
To begin with I really enjoyed the book's structure – one can see that the author had a clear view of the book: introduction to the functionality, its presentation with examples and a short review. By keeping such a fixed structure the reader wasn't surprised by the content in each of the chapters what made reading even more pleasant.
Let's move quickly through the book content chapter by chapter.
Basic Guava Utilities
Functional Programming with Guava
In this chapter the author shows how to introduce some functional approach to your Object oriented Java code with the Function, Predicate and Supplier interfaces and their corresponding utility classes Functions, Predicates and Suppliers.
Working with Collections
Since the Guava library emerged from issues related with collection manipulation the author could show the best examples in this chapter. You will learn about the Collections, FluentIterables, and Iterables utility classes. The author also mentions the Range class that you can use to represent boundaries. You will also be able to find information on other types of collections such as Bimaps (maps that aside from being navigated in the standard key to value way can be navigated from values to keys), Tables (replacement for map of maps), Multimaps (values are collections). There is also a part of the chapter related to the Ordering class that fives you additional posisbilities of working with Comparators.
Concurrency
The issue of concurrency is a very difficult issue as such. Guava can assist you in this difficult subject in a number of was that the author depicts: the Monitor class (version of a Mutex) can help you provide the serial access to part of your code, the Futures utility class to work with Future instances and many more cool solutions ;)
Guava Cache
The author shows several ways of creating caches, showing their statistics and how to configure them. You will also be able to learn how to register listeners for different cashe related types of events.
The Event Bus
The author shows how to subscribe to events by using the Google Guava's Event Bus. What I really liked about this chapter was the presentation of the reason for incorporating it in a project (loose coupling) and a sample of using it in a Spring based application.
Working with Files
You will be able to find presentations of the utility classes and helpful solutions related to working with IO such as Files, CharStreams, ByteStreams, Readers , Writers the Closer class (elegant way of ensuring that the Closeable instance gets properly closed). The author presents the concept behind source and sinks too. So if you work a lot with files you will find plenty of cool stuff here.
Odds and Ends
Useful classes related to creating hash codes, working with Throwables and creating your applications in a null safe way.
Speaking of which, what I really wanted to look at from the very beginning where the code samples showing how cool and helpful Guava really is. Being a true fan of unit testing I was very happy to see that the author put a lot of effort in those examples - the majority of functionalities were described by means of unit tests and showing some real life situations.
To sum it up I think that Bill Bejeck has put a tremendous effort in writing his book and he has done the job exceptionally well. I would recommend „Getting Started with Guava” for both newbies and experts – for sure both of these groups will be very satisfied.
The online tutorials/documentation for Guava are quite extensive. I wonder how much "added value" this book brings in comparison to them?
ReplyDeleteHi!
ReplyDeleteThanks for replying :)
I've seen the online doc https://code.google.com/p/guava-libraries/wiki/GuavaExplained which is pretty cool but there are not that many real life examples presented. On the other hand Guava is so extensive that there are many things missing in the book like StopWatch for instance which is a very useful class. There is another online documentation like this one http://www.slideshare.net/tomaszdziurko/google-guava-almost-everything-you-need-to-know that has plenty of examples.
I think that this is book is a cool addition to the online docs cause it focuses on the majority of the most useful tools, gives some background on using it and in addition shows examples using unit tests. I wouldn't say that it would replace any of the aforementioned resources since it's a Getting Started book but it definitely is useful (at least I found it useful to some extent).
I think that if you feel like a Guava pro from all the categories presented in the book you might find the majority of the book too easy for you (but still I wouldn't be surprised if you found at least one thing that you didn't know of).
Regards :)
P.S.
I don't receive any money for the review nor did anyone force me to write anything nice about the book :D
As a coding addict, I'm impressed!
ReplyDelete