Page 3 of 6

Following Chapter 1, "Introduction to Networking," the authors clearly show that they consider secure communications a very important topic: Chapters 2 and 3 are called "Introduction to Cryptography" and "The Java Security Model," respectively. And it doesn't end there. Five more chapters (for a total of 7 out of 29) are devoted to increasingly advanced cryptography, encryption protocols, and algorithms. Personally, I disagree that secure communications need to be covered in such detail. Although an important topic in its own right, it should be covered in just one or two chapters in a book with "Network Programming" as its title (admittedly the front cover does state "Covers Cryptographic techniques for secure Internet applications," so readers are forewarned).
The book's main strength is its very high-level approach to designing networking applications. The following quotation is
just one small example of which wavelength these authors are on: "...the MessageCopier will be the only thread that can experience an IOException as a result of a failure in the underlying communications channel. We can thus write an application that does not need to
be able to handle communications failures occurring wherever a read() call occurs. Instead, we can write most of the code to only handle errors of incorrect message formats and other programmer
errors...." This is software engineering in action, not Java hacking, and is why I really liked this book. Many authors can
show you how to hack a bit of code, but few can show you how to design clean and flexible systems.
Another aspect of the book that impressed me was the quality and consistency of the diagrams. To explain the architecture of their stream-based networking applications, the authors do not use a conventional notation (like a Booch object diagram or such), but rather their own, infinitely clearer (!), iconography. Some of the later diagrams start to look so much like electronic circuit diagrams that they are almost small pieces of art. I loved them.
The book is not without its share of errors, though. One of the more serious errors is found in Chapter 27, "Object Serialization
and Persistence." Twice the authors state that ObjectOutputStream inherits from DataOutputStream. These statements are incorrect since ObjectOutputStream inherits from OutputStream and implements the ObjectOutput interface. ObjectOutput then implements the DataOutput interface. The problem with this error (which at first doesn't look very important) is that the authors further state that
ObjectOutputStream.writeInt() is inherited from DataOutputStream.writeInt(), implying that ObjectOutputStream streams are somehow compatible with DataOutputStream streams, which is again false. The streams produced by ObjectOutputStream and DataOutputStream are totally incompatible, which is why JavaSoft couldn't subclass DataOutputStream to produce ObjectOutputStream in the first place!
On the code front, as with the O'Reilly book, the authors use extremely poor program identifiers, including i1, o0, mI, qO (these would undoubtedly be qualified as "horrors" in Steve McConnell's Code Complete, the bible of good coding practice (published by Microsoft Press)). In this case, the choice of identifiers seriously degrades the readability of the programs, even more so than in the case of the O'Reilly book. Surprisingly, in view of the otherwise excellent use of diagrams, the authors also forgot or did not deem it necessary to include class hierarchy diagrams for either Java's networking packages or their own. In the case of Java's networking packages, this omission becomes a problem because the authors also do not provide complete class listings. This means that the reader is left in the dark as to the full extent of the classes and methods available to the programmer.

Let's begin with the sloppy explanations. Here are a few entries from the glossary:
Any Java programmer with some experience will instantly recognize the flaws in the above "definitions." Within the text, the author further mixes up the following concept pairs: byte and character, class and object, and subclassing and implementing an interface.
As for some examples of the poor writing style, how about this: "Once we detect some semblance of information coming across the socket, we must pop a thread automatically and let the thread get and process the information." Need another example? Try this: "UDP is a 'spit in the wind' protocol. One day, you wake up, spit into the wind, and hope it will land somewhere." Or this: "Datagrams are sort of like that old 'I love Lucy' episode in which Lucy and Ethel go to work in a candy factory. As they stand in front of a conveyor belt, little candies begin to flow out. Lucy and Ethel are able to wrap and package the candies as they come out. Soon, their boss speeds up the belt and the candies begin to flow out really fast and Lucy and Ethel are unable to keep up." .... Did I say the title contained "Advanced?" Add to this a chapter on JavaBeans and one on JavaOS and JavaSoft's Java Microprocessors, which have absolutely no place in a book on Java Network Programming.
Java Networking book.By Anonymous on October 15, 2009, 4:26 pmSuggust me books related to java networking with focus on communication using TCP, UDP and other protocols and techniques like Peer to Peer that can be used for...
Reply | Read entire comment
View all comments