I’ve received quite a few e-mails from members looking for a good Java programming book. If you happen to be in the market for such a book, Thinking in Java (Bruce Eckel, 2000, Prentice Hall, $ 32.39) might be just what the doctor ordered. Thinking in Java is the book version of Eckel’s “Hands-on Java” seminar. (The seminar is also offered as a CD, which we recently reviewed.)
The book consists of 15 chapters plus four appendices and was written specifically to cover the latest release of Java, Java 2 (aka JDK 1.3). Each chapter includes review exercises to reinforce what you’ve learned. To make things at least a little challenging, the answers to the exercises are not included in the book but are instead available from the author’s Web site. The book includes a CD containing electronic versions of the text in several formats, all the source code used in the book, and a special electronic version of the author’s “Thinking in C: Foundations for Java and C++” seminar.
Eckel writes in an engaging style and provides many examples illustrating the concepts he covers, although some readers will likely complain that these examples are too lightweight. True, these are by no means “real-world” examples of “real-world” code. They are, however, clear, simple, and easily understood.
|Thinking in Java by Bruce Eckel|
Thinking in Java starts the reader out with a basic review of object-oriented programming, briefly explaining integral topics like abstraction, inheritance, and object relationships. The book then quickly moves into the basics of analysis and design, giving the reader a passing acquaintance with design tools like case diagrams and class responsibility cards along the way. And that’s just Chapter 1. By the time the reader reaches Chapter 5, “Hiding the Implementation,” he or she will have learned basic Java syntax and constructs, basic design, object creation, garbage collection, method overloading, Java’s exception model, and package construction. This all takes place in the first 250 or so pages of the book, so the reader is rapidly prepared for the more advanced topics to come in the next 800 pages.
Eckel proceeds to tackle the triple-header of inheritance, polymorphism, and inner classes. If you were to pick a random programmer and ask to have these topics defined in 100 words or less, you’d see just how difficult explaining these subjects can be. However, the book’s aforementioned examples, along with Java’s simple implementation of these features, combine to make these topics easy to grasp.
The final five chapters cover more advanced topics. Chapter 12, “Run-Time Type Identification,” explains Java’s method of determining the exact type of an object along with its supported methods at run time. This is extremely useful in Internet applications. Chapter 13, “Creating Windows and Applets,” discusses the basics of GUI creation using the Swing library and introduces JavaBeans. Multithreaded applications are discussed in Chapter 14, while Chapter 15 introduces distributed computing concepts such as servlets, JSPs, Remote Method Invocation (RMI), and Enterprise JavaBeans (EJB).
The first three appendices offer additional information on how Java passes objects, Java Native Interface (JNI) programming, and style guidelines; the fourth appendix provides a list of suggested books. Of all the appendices, I found the JNI appendix to be the most interesting. JNI is the interface Java uses to communicate with “native methods,” or functions written in C++ that provide platform-specific functionality. This is the mechanism through which Java achieves its trademark portability, and learning about JNI provides a glimpse of how Java works “under the hood.”
The particularly cool thing about Thinking in Java is that even though a large amount of information is covered at a rapid pace, it is somehow all easily absorbed and understood. This is a testament to both Eckel’s obvious mastery of the subject and his skilled writing style. Be warned, however: This book is about programming in Java; if you are looking for help in other areas—say, getting, installing, and using the JDK—you might want to look elsewhere. On the other hand, if you want to build a solid understanding of programming and program design in Java, then give Thinking in Java a look.