Angelika Langer - Training & Consulting

 
HOME | SEMINARS | TALKS | ARTICLES | BOOKS | LINKS | IOSTREAMS | GENERICS | ABOUT | NEWSLETTER | CONTACT | SITEMAP
Book Review - Practical Java

Books  
HOME 
SEMINARS 
TALKS 
ARTICLES 

BOOKS

  OVERVIEW
  REVIEWS

  BIBLIOGRAPHY    
    J2SE
    J2EE
    CORE C++
    STL
    TEMPLATES
    IOSTREAMS
    CONCURRENCY
    I18N
    PATTERNS
    OOA/OOD
    TESTING
    MANAGEMENT
 

LINKS 
IOSTREAMS 
GENERICS 
ABOUT 
NEWSLETTER 
CONTACT 
SITEMAP 
Book Review - Practical Java
   
  Book Review of the week  
 
 
  Practical Java Programming Language Guide 
  By Peter Haggar 
  Reading,MA:Addison-Wesley Longman 
  ISBN 0201616467 
  288 pages 
 
  Price: $32.95 
(Reviewed 2/23/00) 
 
Second-Generation Java Title on Programming Idioms and Practical Tips 
Goes beyond the language features and JDK APIs

A second generation of Java books is showing up on bookstore shelves these days. Practical Java Programming Language Guide by Peter Haggar is one of them. Before we delve into the characteristics of this particular book, let us explain what we mean by "second generation of Java books." 

The first generation of books were published when Java was young and new to all of us in the IT business. These early books covered elementary topics such as the concept and syntax of the language, the API of its huge libraries, the ideas and intentions that Sun was bringing into the language in cooperation with other companies. While these books were, and still are, excellent reading when you need to understand the various constructs and concepts of the language and its API, none of these books aimed to explain Java's idioms or pointed out the less obvious limitations of some concepts or discussed conceivable workarounds. The reason for this is pretty obvious: at that time no one had enough experience with Java to write such a book. 

Now that Java has been around for quite a while (roughly five years), enough experience has been made and enough know-how has been gathered so that a new generation of Java books can be published these days. These new books present Java idioms and tips culled from real-world use rather than serving simply as introductory text books or Java primers. Resorting to C++ for an analogy, we'd say that Bjarne Stroustrup's C++ Programming Language is a typical example of a first-generation book, while Scott Meyers' Effective C++ volumes are examples of a second-generation book. 

By the way, the reference to Meyers' books is on purpose. In the preface to his book, Haggar explains that the style and structure of Practical Java Programming Language Guide is strongly influenced by them; indeed, two of his Java tips are directly inspired by corresponding C++ tips from Meyers. 

Following the tradition of Effective C++ , Haggar's book contains 68 design and implementation tips for Java, named Praxis 1 through Praxis 68. Each tip is explained, often together with source code, on one to ten pages (totaling 250+ pages). These "praxis" tips are grouped into six blocks: 

  1. General Techniques
  2. Objects and Equality
  3. Exception Handling
  4. Performance
  5. Multithreading
  6. Classes and Interfaces
In addition to these tips the book contains an index, an appendix with references to further reading (with a brief description of each book or magazine), and the presentation of a learning technique that was used in Peter Haggar's IBM lab when they learned C++ (he suggests using the same technique for learning Java). 

Let us take a look at the heart of the book: namely the tips. All of them are helpful explanations of problems, which a novice or seasoned Java programmer might not be aware of. Each tip comes with a conceivable solution. An example is the tip "Never hide an exception." It explains that the initial exception is hidden and error information is lost when another exception is raised in the catch or finally block that is associated with the initial exception. The suggested solution is to accumulate all occurring exceptions and propagate all of them (bundled into one exception) from the finally block. 

There are some caveats, however. Despite the fact that Haggar's helpful tips are distilled from his actual work with Java, Practical Java Programming Language Guide left us a bit confused here and there. Our confusion has nothing to do with the book as a whole. It simply seems strange to us that Java?heralded as the next big programming language?needs a nine-page section (one of the longest in the entire book) entitled "Optimize source code by hand" (Praxis 44). In this section you're confronted with terms such as Constant Folding, Loop Unrolling, etc.?terms familiar to every compiler builder, and that no programmer should normally be concerned with. Another valid, yet unsettling, rule is, "Do not rely on finalize methods for non-memory resource cleanup" (Praxis 67). If so, what is the finalize method for? For unreliable non-memory resource cleanup? It is not the author's fault that the reader might be puzzled here; we came up with similar rules from our own experience with Java. On a positive note, Haggar is fair enough to point out Java's dark corners. 

The bottom line is this: Practical Java Programming Language Guide is a very helpful book containing an excellent collection of rules that reflect today's Java practice. We expect that some time in the near future most of these "tips" will actually become "rules" in programming guides for Java projects. 

Angelika Langer develops and teaches classes on advanced C++, STL, multithreading, internationalization, and Java. She served on the ANSI/ISO C++ Committee from 1993 to 1998. Klaus Kreft is a software architect and consultant with 15+ years of experience in industrial software development. He works for Siemens Business Services in Germany. Langer and Kreft are authors of "Standard C++ IOStreams and Locales: Advanced Programmer's Guide and Reference" (Addison-Wesley, 1999) and are columnists for C++ Report magazine. 

 
If
 

 
© Copyright 1995-2003 by Angelika Langer.  All Rights Reserved.    URL: < http://www.AngelikaLanger.com/Articles/Reviews/PracticalJava/review.htm  last update: 28 Oct 2003