I am not really a fan of Cookbook style books. However, by looking at the table of contents of the Java Cookbook, it’s clear that the chapters on this book run parallel to chapters in more classical technical books, e.g. the excellent Core Java books by Horstman and Cornell. While the more classical books try hard to provide a logical structure within the chapter with the needed context (a story) to master the content, cookbooks give you independent ready-to-use recipes (yeah for metaphors!). So it’s really about getting a proven solution fast than (deep) understanding. But you should get that from the title, so no surprises there.
My specific use case is simple. I want to do some Java coding soon, and needed a quick refresh on the language. While not so long ago I used Java 7 features for a private project, most of my Java coding in the past was based on Java 6. Java 8 seems to have nice improvements, so a fresh-from-the-press Java Cookbook (3rd edition, July 2014) seemed a fast way to get up to date. With 900+ pages, “fast” is of course relative. By this standard, the books delivered.
The content is *very* varied. Some chapters needed careful reading (or even re-reading), while others could be skimmed or even skipped. Recipes include (citing the product page):
- Methods for compiling, running, and debugging
- Manipulating, comparing, and rearranging text
- Regular expressions for string- and pattern-matching
- Handling numbers, dates, and times
- Structuring data with collections, arrays, and other types
- Object-oriented and functional programming techniques
- Directory and filesystem operations
- Working with graphics, audio, and video
- GUI development, including JavaFX and handlers
- Network programming on both client and server
- Database access, using JPA, Hibernate, and JDBC
- Processing JSON and XML for data storage
- Multithreading and concurrency
As you can see, it’s a mixture of very basic and advanced stuff and that kind of thechnical width has its risks. Some recipes are too obvious and not more useful than the javadoc showing the classic usage of a standard method of a standard class (e.g. substr from String). As such, I don’t think it can replace a good book from a “Learning/Starting” series if you’re new to Java. A similar phenomenon happened on the other side of the spectrum. For more complicated subjects (like the new functional aspects in Java (lambdas), GUI development or threading) a cooking recipe just doesn’t provide enough context to really grasp the concepts. I hope the following screenshot from the book illustrates my point (and also shows what I don’t like about java):
Despite this warning, I can say that most of the recipes are useful. By example, even the first chapter (“Getting Started: Compiling, Running, and Debugging”) was surprisingly useful because it included things like ant, maven and gradle. There is lots of content to skim (it’s OK, it’s a cookbook!), lots of interesting stuff to read, lots to use with a mental note “need to dig deeper here” and even some annoyances from time to time (I wish the author would stop pushing his own classes for trivial stuff, like removing tabs (!)).
As a conclusion we can say that if you like cookbooks, this could be a good one. If you don’t, it depends on your expectations. Mine were met, no more, no less. 3 out of 5.
|
Filed under: Uncategorized Tagged: bookreview, books, goodread, Java, o'reilly, Programming
