To appear in Computing Reviews, April 1997
© 1997 Association for Computing Machinery
Reprinted by permission

COMPARATIVE REVIEW

Barlett, Neil (Great Explorer Software Consulting, Ltd.); Leslie, Alex (NetExcel); and Simkin, Steve (Northern Telecom)
Java programming explorer.
Coriolis Group Books, Scottsdale, AZ, 1996, 820 pp., $39.99, ISBN 1-883577-81-0.

Cornell, Gary (University of Connecticut); and Horstmann, Cay S. (San Jose State University)
Core Java.
SunSoft Press, Mountain View, CA, 1996, 622 pp., $39.95, ISBN 0-13-565755-5.

Daconta, Michael C. (Mystech Associates, Inc., Arizona)
Java for C/C++ programmers.
John Wiley & Sons, Inc., New York, NY, 1996, 443 pp., $39.95, ISBN 0-471-15324-9.

Flanagan, David
Java in a nutshell: a desktop quick reference for Java programmers.
O'Reilly & Associates, Inc., Sebastopol, CA, 1996, 438 pp., $14.95, ISBN 1-56592-183-6.

Lemay, Laura; and Perkins, Charles L. (Virtual Rendezvous)
Teach yourself Java in 21 days.
Sams.net Publishing, Indianapolis, IN, 1996, 527 pp., $39.99, ISBN 1-57521-030-4.

Naughton, Patrick (Starwave Corp.)
The Java handbook: the authoritative guide to the Java revolution.
Osborne McGraw-Hill, Berkeley, CA, 1996, 424 pp., $27.95, ISBN 0-07-882199-1.

By now, nearly everyone in the computing field knows what Java is: an object-oriented, Internet-aware language with the potential to revolutionize programming. After Java's formal introduction in the spring of 1995, there was only a short delay before books on Java began to appear. The first wave of books, published late in 1995, were superficial: they explained what Java was, presented a number of applets, and spent a lot of time discussing Sun's HotJava browser.

The books discussed in this review are part of the second wave--the first serious Java books. They are much longer and more detailed than their predecessors. Their focus is on the Java programming language itself, and most assume that the reader has some previous programming experience.

All the books under review are trade books rather than textbooks. As a result, they share characteristics common to many trade books. None of the books has exercises, nor do any provide a bibliography or references for further reading. As a result of the rush to get these books into print, attention to detail is often lacking. Typographical and minor technical errors are common. None of the books in this group has an excellent index, and in several the index is noticeably substandard.

Barlett, Leslie, and Simkin

In this collaborative effort, each of the 22 chapters is written by one of the three co-authors. Chapters 1 and 2 discuss Java in general terms and describe what applets are. Chapters 3 and 4 cover most of the basics of Java. Chapter 5 describes exceptions in detail, while Chapter 6 explains object-oriented programming. Chapter 7 discusses strings. Chapter 8 covers input and output. Chapter 9 describes Java's data structures. Chapter 10 covers the Date and Time classes. Chapter 11 develops a sample application. Chapter 12 discusses applets. Chapters 13 through 19 discuss GUI programming, graphics, images, animation, and sound. Chapters 20 through 22 cover threads, networking, and interfacing with C.

At 820 pages, this is by far the longest book in the group, allowing topics to be developed in more depth. Its coverage of Java's Abstract Window Toolkit (AWT) is the best of any of the books. Moreover, this book has the greatest variety of examples, including many medium-size and large programs. Unfortunately, the authors often use the extra space to ramble and include irrelevant material. Page 441, for example, is occupied almost entirely by a brief e-mail message, complete with all the header information.

The book's writing style is best described as verbose and chatty. The forced attempts at humor are often annoying. (Chapter 20, for example, is titled "Nice Threads, Javaman!") The bad jokes ("Q: What shape is made by a parrot when it is squashed under the front wheel of a car? A: A poly-gone.") tend to distract rather than amuse.

The index is so poorly done that it deserves special mention. For one thing, it is "hierarchical"; as a result, the entry for "buttons" does not appear under the B's. Instead, the reader must know enough about Java to guess that "buttons" is a subentry under "components." Not only does this practice make the index hard to use, but it leads to a huge number of sub-subentries. To make matters worse, the index is full of irrelevant trivia: there are entries for "The Fly," "Disneyland," and "Dutch National Public Radio," to name just a few.

Although the book is attractively designed, some programs are afflicted with a formatting glitch that removes indentation from random lines.

Overall, this is a good book. It would have been even better if it had been tightly written and edited carefully, and if it had a decent index.

Cornell and Horstmann

This book is one of several in SunSoft Press's Java Series. It is aimed at a more advanced audience than most of the other books under review--in the words of the cover blurb, it provides "hard core Java for serious programmers." Readers are assumed to know C, C++, or Visual Basic. In fact, this is the only book in the group to provide comparisons of Java with Visual Basic (in addition to the more common C++ comparisons).

The book is divided into 13 chapters: An Introduction to Java, The Java Programming Environment, Fundamental Programming Structures in Java, Objects and Classes, Going Further with OOP: Inheritance, Graphics Programming with AWT, Designing User Interfaces with AWT, Applets, Data Structures, Exceptions and Debugging, Input and Output, Multithreading, and Networking. Its coverage of advanced topics is uniformly good; the descriptions of data structures, exceptions, threads, and streams are the best of any book in this group.

Applications are stressed over applets. Applets aren't even covered in any detail until halfway through the book, and the vast majority of sample programs are applications. The large assortment of programs--which tend to be medium-size rather than large--includes many that are nontrivial. Even the short programs are often quite interesting.

In contrast to the levity of Barlett, Leslie, and Simkin, this book has a more serious tone. It manages to be authoritative without being stuffy or boring.

Although this book is not appropriate for a programming novice, just about anyone with some experience would benefit from reading it. It is thorough and detailed, yet easy to read.

Daconta

As its title implies, this book teaches Java primarily by comparison with C and C++. There are only eight chapters: An Introduction to Java; Comparing Java to ANSI C; Comparing Java to C++; The Java Standard Library; Language Features Not in C or C++; Abstract Window Toolkit; HotJava, Applets, and JavaScript; and Comparing JavaScript to Java. The final two chapters are notable; none of the other books under review discuss JavaScript, a scripting language that's only superficially related to Java.

Although the chapters comparing Java to C and C++ are helpful for readers who already know those languages, they could be much better. The author wastes too much space bashing C and C++ rather than explaining Java. Moreover, he feels compelled to walk the reader through the two languages--and their standard libraries--in more detail than is necessary. For example, he lists all the required signals in C, an irrelevant detail.

This book is notable for its brevity. Although it is not the shortest book among those under review, it is tied with Barlett, Leslie, and Simkin for the lowest density (maximum number of words per page). Moreover, half of the book consists of program listings, with some as long as 14 pages. Portions of the book are little more than annotated programs. As a result, this is the most shallow of the books in this group. The good news is that the book contains plenty of sample applications, including many that are medium to large in size. (Applets are slighted, however; there are only two in the entire book.)

The book's organization is suspect. For example, Chapter 4 ("The Java Standard Library") has just two sections, Overview of the Java Standard Library (6 pages) and Detailed Description of the Java Standard Library (92 pages). This chapter should have been divided into more sections or else split into several chapters.

The poor organization of this book is reflected in its overly sparse table of contents, which is only two pages long. (In the other books, the table of contents is 5 to 18 pages long.) The table of contents lacks entries for a number of key Java concepts, including input/output, networking, components, events, graphics, and images.

The book's prose style is a bit too breezy ("Boy, all this slapping around of pointers, which I find to be crucial to complete the training of any programmer.") and the "gee whiz" tone can be cloying. ("These are truly exciting times! ... In Java and HotJava we have tools that make programming fun again! That is truly exciting because there is nothing more powerful than a programmer having fun!")

One last quibble: When Java code is mixed with ordinary text, it is not distinguished from the text in any way (by using a different typeface, for example). As a result, some sentences have to be read more than once to determine their meaning.

Overall, this book gives the impression of being quickly thrown together, padded with program code and unnecessary details about C and C++, and formatted for maximum length.

Flanagan

Unlike the other books, this one purports to be a "quick reference" rather than a tutorial. Still, it contains enough tutorial material to be included in this group.

The chapters and appendices (collectively referred to as "sections") are divided into five parts. Part I ("Introducing Java") compares Java with C and explains classes and objects. Part II ("Programming with the Java API") covers applets, GUI programming, input and output, networking, image processing, and threads. The remaining parts contain reference material. Part III ("Java Language Reference") covers Java syntax, events, fonts, colors, cursors, system properties, applet parameters, applet security, HTML and HTTP syntax, Unicode, and JDK development tools. Part IV ("API Quick Reference") lists the contents of the packages in the Java API. Part V ("API Cross References") contains cross-references that make it possible to determine in which package a particular class is defined, which class defines a particular method, which classes extend a particular class, which classes implement a particular interface, which methods return instances of a particular class, which methods take arguments of a particular class, and which methods throw a particular exception.

Parts I and II constitute a highly condensed, 171-page tutorial on Java, aimed at experienced C and C++ programmers. Part I, which covers language basics, suffers from disorganization and excessive condensation. Part II, which describes advanced features, is better organized, but consists largely of program code accompanied by sparse commentary. The author makes little attempt to explain general principles; instead, he expects the reader to infer these by studying the code.

The remainder of the book is reference material. Here is where the book's primary value lies. Part IV lists every class in the Java API, with methods and variables shown. Sadly, there is little description of what the methods do. (Granted, describing the methods fully would have added hundreds of pages to the book.) The cross-reference information in Part V is one of the book's most useful features.

The best things about this book are its low price, extensive reference material, and realistic programs. It presents a detailed but highly condensed description of Java. Experienced C and C++ programmers may prefer its no-nonsense manner, but less-experienced programmers will find its terminology daunting and its pace too fast.

Lemay and Perkins

This book, a huge best-seller, was the first to cover Java in any depth. Although many other Java books are now available, this one remains among the leaders.

As the title implies, the book is divided into 21 chapters ("days"), each written by one of the co-authors. The first seven chapters cover basic language features, including arrays and classes. Chapter 8 discusses applets. Chapters 9 through 14 describe Java's support for graphics, animation, images, sound, and GUI programming. The next six chapters cover access control, packages and interfaces, exceptions, threads, streams, and native methods. The final chapter discusses implementation details, including the Java virtual machine, garbage collection, and security.

It's not hard to see why the book has sold well. The writing is clear and easy to understand. The tone is informal without being silly. There are plenty of examples. The pacing is good, allowing the reader to progress at a slow but steady rate. Q&A sections at the end of each chapter address frequently asked questions about Java.

Still, the intended audience for this book is not entirely clear. On the one hand, the development of basic language features seems aimed at a reader without significant programming experience. On the other hand, there are relatively few complete programs in the book, and most of these are short and artificial; beginners would be better served by having at least a few large programs to study. Moreover, the book delves into advanced topics (native methods and implementation details) that are likely to be of little interest to inexperienced programmers.

Overall, this book is a good choice for someone with limited programming experience. Its friendly manner and many short examples should make learning Java relatively painless. More experienced readers may find it to be too slow and lacking in depth.

Naughton

Alone among those under review, this book is written by a person who participated in the creation of Java at Sun Microsystems. (Naughton, in fact, founded the team that developed Java.) References to the history of Java are scattered throughout the book; an epilogue presents a detailed account of Java's early years.

The book's 20 chapters are divided into three sections. The first section, Java Language, covers basic language features, including classes, packages, and interfaces. The second, Java Classes, focuses on strings, exceptions, threads, utility classes, input/output, networking, applets, the AWT, and imaging. Each of the three chapters in the final section, Java Applets, is devoted to developing a nontrivial applet.

The book assumes little previous programming experience. It carefully covers all Java features, including the ones inherited from C. The first 17 chapters are nearly identical in their approach: language features and library classes are explained one by one and illustrated with short programs. The reader who wants to see a "real" program, not just an artificial example, must wait until the final three chapters. Since it devotes so much space to elementary topics, the book tends to give short shrift to the more advanced aspects of Java.

This book is notable for its insider's look at Java and the interesting applets it presents in the final three chapters. The rest of the book is passable, but the lack of realistic examples hurts it in comparison to the other books under review.

Comparison

Cornell and Horstmann is the best choice for experienced programmers. It is unmatched for technical depth, yet remains highly readable. Less experienced programmers who want a more leisurely introduction to Java will prefer the relaxed pace of Lemay and Perkins. Bartlett, Leslie, and Simkin is a good book also. It has a poor index, however, and some readers may find its flippant tone to be distracting. Flanagan is a valuable reference at a bargain price, but as a tutorial it is suitable only for highly experienced programmers who want a quick and dirty introduction to Java. Naughton provides a unique perspective on Java, but lacks depth and doesn't have enough nontrivial examples. Daconta, on the other hand, is a worthwhile source of lengthy examples, but is even more shallow.

The Java book scene is likely to change dramatically in the near future. By this time this review is published, scores of new books will have appeared. Still, many of the books in this review are likely to survive, albeit in new editions.

--K. N. King, Atlanta, GA

Table 1: Descriptive Data
Barlett, Leslie,
and Simkin
Cornell and
Horstmann
Daconta Flanagan Lemay and
Perkins
Naughton
Number of pages 820 622 443 438 527 424
Density (maximum
number of words per page)
525 575 525 775 625 600
Number of chapters 22 13 8 9 21 20
Number of appendices 3 3 3 24 4 1
Glossary No No No Yes No No
Access to program code CD-ROM
included
CD-ROM
included
Disk
included
Via
Internet
CD-ROM
included
None
Purpose Tutorial Tutorial Tutorial Reference,
tutorial
Tutorial Tutorial
Background assumed Little or no
programming
experience
C, C++, or
Visual Basic
experience
C or C++
experience
C or C++
experience
Some
programming
experience
Little or no
programming
experience

Table 2: Subjective Evaluation
Barlett, Leslie,
and Simkin
Cornell and
Horstmann
Daconta Flanagan Lemay and
Perkins
Naughton
Number of complete
programs
High High High Low Medium High
Number of nontrivial
programs
High High High Medium Low Low
Program emphasis
(applets versus
applications)
Applications Applications Applications Evenly divided Evenly divided Applications
Quality of index Poor Good Fair Good Fair Good

Table 3: Topic Coverage
Barlett, Leslie,
and Simkin
Cornell and
Horstmann
Daconta Flanagan Lemay and
Perkins
Naughton
Applets Very good Excellent Good Good Good Fair
Abstract Window Toolkit Excellent Good Fair Minimal Good Fair
Data structures Very good Excellent Minimal Minimal Minimal Minimal
Exceptions Good Very good Fair Fair Fair Fair
Threads Good Very good Fair Fair Fair Fair
Streams Good Very good Minimal Fair Good Fair
Networking Very good Very good Minimal Fair Minimal Fair
Native methods Good None None None Fair None
Java internals None None None None Fair None
JavaScript None None Fair None None None