Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

Java network programming books: A comparative review

Laurence sifts through another batch of Java books, trying to separate the nuggets from fool's gold

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone

Page 2 of 6

The Serialization attribute indicates to what extent the book covers the 1.1 Serialization API and its uses. Pre 1.1 books do not touch on this API at all.

The RMI attribute indicates to what extent the book covers the 1.1 Remote Method Invocation API and its uses. Pre 1.1 books do not discuss RMI at all.

Finally, the Servlets attribute indicates to what extent the book covers servlets (server applets). Pre 1.1 books do not cover servlets at all.



Java Network Programming (O'Reilly)

Java Network Programming treats the core java.net, java.rmi, and javax.servlet packages (Java's packages that contain the APIs most relevant to network programming) in a thorough and logical manner. Chapter 1 sets out to entice the reader by enumerating some classic, state-of-the-art networking applications (chat, collaborative, and shopping cart applications, for example) for which Java can be easily used.

Java Network Programming



Chapters 2 and 3 introduce the basic TCP/IP and WWW concepts and mechanisms. The remaining 13 chapters use the various Java networking APIs as a guiding thread. Most of these chapters discuss a few classes at a time, consistently discussing constructors, methods, and exceptions, in that order. These chapters then end with a helpful section called "Some Useful Programs." Within this section, you'll find such programs as Javalookup, which performs DNS lookups from the command line; Pagesaver, which grabs a single Web page and saves it to your local hard disk while transforming all relative URLs to absolute URLs; and ImageSizer, which grabs a single Web page containing images and saves it while regenerating the image tags to contain width and height information. (Pages that omit this information do not allow the browser to display the page before all images are loaded, so ImageSizer magically fixes this annoying problem.)

The order of the chapters is logical, commencing with a discussion of the InetAddress, URL, Socket, ServerSocket, DatagramPacket, and DatagramSocket classes. The more advanced material continues with a discussion of the URLConnection class and the non-trivial URL protocol and content handlers system, MulticastSocket, RMI, and the Java Server API. The API material provided in each chapter is enhanced by adding extra layers of abstraction. For example, Chapter 9, which deals with UDP programming, presents a class (UDPClient) that hides the low-level details of byte arrays normally required for UDP-level programming.

Despite the overall quality of the book, there are still several problems that manage to harm it. At a global level, Harold almost totally ignores multithreaded programming. This is very surprising since few non-trivial networking applications can be written in a single-threaded fashion. The book is also very sparse on figures and diagrams. The quality of code identifiers also leaves much to be desired; many of them are just one or two characters in length (a, e, o, u, s, r, p1, p2), or ignore established case conventions (uppercase variables, lowercase constants, lowercase class names). Using just two spaces as indentation unit, deeply nesting try-catch statements, and catching Exception instead of more specific exception types further erodes code quality in this otherwise above-average book.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comments (1)
Login
Forgot your account info?

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

Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources
  • JavaSoft's Java Tutorial is always a good source for officially sanctioned code examples, although it usually takes a while for the tutorial to reflect the latest APIs. The tutorial includes sections on the networking APIs. http://www.javasoft.com/doc/tutorial.html
  • This Web page is the home of a mailing list devoted to Java network programming discussions. It also contains a link to the complete archive for this list (unfortunately as a single 3Mb text file!). http://www.cdt.luth.se/~peppar/java/java-networking-list/
  • A Q&A page from San Diego State University's CS596 Client-Server Programming course (rather dated, from early 1996). http://saturn.sdsu.edu:8080/~whitney/courses/spring96/cs596/notes/java/javaNetworkQA.html