Electronic Review of Computer Books

[ ERCB Home | New | Feature | Brief | DDJ | Letters | Links ]

[an error occurred while processing this directive]

Java Pro

Review by Warren Young
Copyright (C) Dr. Dobb's Journal, October, 1997

Warren, a software engineer with Educational Technology Resources, can be contacted at tangent@cyberport.com.

It seems that Java is finally heading into the professional arena. The evidence? Industry numerologists have relaxed now that the fateful "1.0" stage is behind us, the language itself is stabilizing, and new libraries oriented toward corporate development are popping up like mushrooms in a rain forest. Also appearing with increasing rapidity are Java books aimed at the professional programmer. Here, I'll review an exemplary pair of Java books for professionals.

A Classic Returns

Less than a year after the amazingly successful first edition of Core Java appeared, Gary Cornell and Cay Horstmann are back with an encore. As with the first edition, its target audience is experienced programmers who are new to Java.

Three chapters are dedicated to an introduction to the actual Java language. Each chapter contains useful comparisons and analogies with Visual Basic and C++; the authors only allude to features of other languages. Still, I think that these chapters are sufficient to bring anyone with previous programming experience quickly up to speed on Java.

Cornell and Horstmann then cover the AWT in two long chapters. Though still primitive by current standards, the AWT is an extensive library, and these chapters cover all its major elements.

Though Core Java's focus is on Java applications, it does briefly cover applets. I found the sections on converting an application into an applet and on the additional facilities available to an applet useful.

The meat of the book consists of chapters that begin plainly enough, but proceed to build up to some useful tool or mechanism that you will probably use in your own programs.

Consider the chapter on Java's container library. After Cornell and Horstmann cover the few containers in the library, they go on to create several new containers, like stacks and linked lists. Similarly, the debugging chapter includes classes that manage log windows for debug messages and AWT events, and the networking chapter offers sample programs that speak common Internet protocols like SMTP and HTTP.

The final four chapters are new to the second edition, starting with the new Java Database Connectivity API (JDBC). The introduction to SQL and basic JDBC calls is among the best I've seen, although the length doesn't permit delving too deep into its subject. Still, it will most certainly get you started.

Remote method invocation (RMI) is also covered. I can't say that it's really anything special, but I did enjoy poking through the authors' "gift warehouse" code example: One of the items in the gardening department is the Handy Hand Grenade&emdash;perfect for getting those stubborn rocks out, no doubt. Cornell and Horstmann also cover native methods. After the basics, they get back to the value-added stuff I like so much. Their final example interfaces Java to a C library for arbitrary-precision numbers.

In the last chapter, the authors try their hands at prognostication as they predict some future Java directions. Cornell and Horstmann wrote this chapter before JDK 1.1 came out, so it's interesting to note that most of their predictions have come true.

Overall, the second edition of Core Java is a bit higher in quality than the first. Despite the 150 additional pages, this edition is actually thinner than the first, so it lays flatter on your desk and takes up less shelf space. The second edition is also laid out better: Code examples and figures are now labeled, API descriptions stand out better from the main text, and icons in the margins are smaller, so they don't run into each other like they did in the first edition. As you would expect, typos and minor inaccuracies are fixed in this new edition. Naturally, the new chapters have their own collection of typos, but a web site listing the latest corrections has been created.

The Great Java Grab Bag

Mark Wutka's Hacking Java is like a big grab bag of Java how-to's. Like a magazine subscription, you shouldn't buy this book hoping that it will help you on your current project. Instead, you should get this book on the theory that there's no telling what the next project might entail.

This is a big book, with 40 chapters that cover an amazing spectrum of topics. So instead of reviewing the book chapter by chapter, I'll just reach into the grab bag and pull out a few of the more interesting items.

The first section of Hacking Java (250 pages) covers applets. I can hear you now, "Oh no, not another book on toy web page applets!" Not to worry, there are a few uncommon gems in here. For instance, there's a chapter that covers reading and writing files in an applet. The trick here is to side-step the applet security model by storing files on the applet server, rather than on the local system. The techniques covered include FTP, the HTTP POST command, and the Java File System package (http://www.focus-asia.com/java/jfs/).

Another section of the book is spent showing you how to write distributed applications in Java with RMI and CORBA. Though the examples in this section aren't as amusing (and therefore engaging) as those in Core Java, they do show the mechanisms appropriately.

I actually have a much larger complaint with this book, and this section contains the largest example of the problem: Mark Wutka is just the primary author of the book. About a half dozen others contributed to the text, which detracts from the book's cohesiveness. The chapter on CORBA clients is written by one author, and the chapter on CORBA servers is written by another, so the two authors' examples don't work together.

Such issues aside, my favorite section of Hacking Java covers the use of Java on the server side of the Web. The bulk of the section covers Java-based web servers like Sun's Jeeves server. The coolest example is a simple agent system that takes advantage of some key features of Java and Java-based web servers. In this system, a user's request for information causes the server to create a Java "agent" object that roams the Internet collecting information. The server serializes the agent object across the network to a cooperating server, where the agent is "reconstituted" in order to search that server for information. The agent bounces this way from server to server, and eventually returns home to be "debriefed." The system is more than a little rough, but it is hands-down the most elegantly workable example of an agent system that I've come across.

I've just touched on a few of this book's features. Other highlights include sections on encryption and on wrapping legacy systems with Java shells.

Conclusion

A book as broad as Hacking Java can't possibly master all that it covers. Indeed, I think Core Java does a better job of covering those few topics where the two books overlap. Still, Hacking Java is very useful, and if the price tag isn't a problem, you might pick up a copy simply for its competent coverage of a cornucopia of Java topics. Beware of the cover, however: It claims that the book contains coverage of JDK Version 1.1, but what you really get is coverage of JDK 1.0.2 plus the add-ons that were eventually folded into JDK 1.1. Core Java takes a more honest position: It also covers JDK 1.0.2 plus add-ons, and even though it doesn't say so on the cover, this fact is made plain early in the book.

As for Core Java, the second edition is a definite improvement to an already great book. This edition maintains the pragmatically critical style that made its predecessor so popular. If you're moving to Java from another language, you won't regret starting with Core Java.

 


Core Java, Second Edition
Gary Cornell and Cay S. Horstmann
SunSoft Press/Prentice Hall, 1997
816 pp., $44.95
ISBN 0-13-596891-7

Hacking Java
Mark Wutka, et al.
QUE Corp. 1996
852 pp., $59.99
ISBN 0-7897-0935-X


Electronic Review of Computer Books
Created 8/16/97 / Last modified 8/16/97 / webmaster@ercb.com