Java Examples in a Nutshell – Book Review


Java Examples in a Nutshell, 3rd Edition
by David Flanagan
Paperback: 720 pages
Publisher: O’Reilly & Associates; 3rd edition (January 1, 2004)
ISBN: 0596006209

In this 3rd edition, author David Flanagan has updated the book with coverage of Java 1.4. In keeping with the tradition of the other nutshell books, this book is an instant must-have book. This book is divided into 4 sections. The first section is a short yet very nice Java and OO tutorial. This book is not meant to replace your regular tutorial book, but can certainly act as that for someone who already knows the basics and is trying to bone up on the language API and usage.

The second section of the book covers the core Java API, including I/O, NIO, threads, networking, security and cryptography, serialization, and reflection. This section of the book is really solid and includes great working and commented examples of most of the core set of Java API. I really liked the network section as it includes code that will fulfill most of your needs in terms of network related development.

The third section of the book deals with graphics and user-interface including Swing, Java 2D graphics, preferences, printing, drag-and-drop, JavaBeans, applets, and sound. Not being much of a UI guy, I glossed over most of this section but it seemed complete and comprehensive. I know where I am going to turn if I ever need to work with Swing or applets.

The last section of the book includes coverage of the server-side Java or J2EE development, including JDBC, JAXP (XML parsing and transformation), Servlets 2.4, JSP 2.0, and RMI. Being a back-end or server side developer, I spent a lot of time consuming this section and I was very impressed with the quality of the coverage, explanation and examples included in this section. The section starts off with a nice introduction to JDBC, database metadata and includes some nice examples configurable example that are ready for use with little or no modifications. I think that’s important to new developers that are getting familiar with an API. In reading the code, it was nice to see the author using the execute() method instead of executeUpdate() or executeQuery() method along with a simple explanation of why he is doing that. Sounds simple, but I can’t tell you the number of times junior developers have come to me and asked me about this exact topic.

After JDBC, the book jumps into XML with a nice intro to SAX, DOM, and XSLT. Not a lot of meat here, but XML is always a moving target in terms of the API. I wish this section had a little more to it as it is missing the whole idea of Java-XML data binding which is a useful topic. After XML, the book moves over to Servlets and JSP. Nice intro to servlets and JSP, but leaves you wanting more. I think the whole server-side Java just needs to be another book and I think David should just come up with a Java Enterprise Examples in a nutshell. O’Reilly already has some great books in this category including the Java Servlet and JSP cookbook.

Having said all that, I still really like this book for how it deals with the core API. This book contains 193 complete, documented examples which makes it a must for any junior developer that knows or is learning Java and wants to know how to apply the API. The examples from this book are available for download from the author’s website located at davidflanagan.com.