Features
- Cover Type: Paperback with 862 pages
- Published by: O'Reilly Media, Inc.
- Edition: 3rd Edition June 14, 2004
- Written in: English
- ISBN 10 Number: 0596007019
- ISBN 13 Number: 978-0596007010
-
Book Dimensions:
8.7 x 7 x 1.6 inches
- Weighs: 2.6 pounds
Reader Reviews
This review is from: Java Cookbook (Paperback)
The idea of a Java Cookbook is a good one. This book is very similar to the popular and widely acclaimed Perl Cookbook. Even though Perl is more useful for short stand-alone programs and Java is most effective in large-scale systems, a lot of Java code can follow a standard "recipe". For example, writing an equals method is a very common and surprisingly difficult task, so having a standard template available along with a discussion of important points is necessary for all but the most advanced Java programmers. To judge the quality of the recipes, I checked out some very basic and common Java problems, such as writing equals and clone methods, synchronizing threads, and comparing floating point numbers. In most cases, I found flaws in the code or accompanying explanations. The discussion of equals doesn't mention that the hashCode method needs to be compatible with it. The recipe for clone has the method unnecessarily throw a CloneNotSupportedException. The explanation of synchronizing threads says that locks are held on methods, instead of correctly pointing out that locks are held on objects. The code for floating point comparison requires that the user keep track of the magnitude of the numbers being compared. By using the term "Cookbook" in the title, I expected to find a collection of the best standard code templates. Instead, I found code samples that merely demonstrated a basic concept, and that they serve as only a starting point for understanding Java. Together with the misleading explanations, this book has the potential for confusing beginning Java programmers as much as it guides them. This book is best used as merely a guide to get the beginning Java programmer started. The "recipes" should be viewed as started points to be improved upon -- using them as is will result in less than optimal Java code.
Comment | |
(Report this)