The Java Series
Phone/Fax: 617-955-3700; 617-942-3077
Reviewer: Kirk Petersen
If you have recently visited the computer section of a bookstore, you have seen the mind-boggling number of Java-related books available. Many bookstores have sections dedicated solely to Java, just as they have sections for programming languages and the Internet. What makes this even more incredible is that the first Java book showed up just a little over a year ago.
The Java Series is a set of nine books written by members of the Java team. This series is published by Addison-Wesley.
Since The Java Series is from the writers of the actual software, it is the official source of information regarding the Java programming language, virtual machine and API. If you want the definitive answer to a Java-related question, these books are the place to look.
This review covers five of the books from The Java Series. The first four are The Java Virtual Machine Specification, The Java Language Specification and The Java Application Programming Interface (two volumes). These are the technical references that describe the entire Java environment. Also included is a review of Concurrent Programming in Java, which isn't a definitive reference like the rest but certainly deserves its place in the series.
Title: The Java Virtual Machine Specification
Authors: Tim Lindholm and Frank Yellin
All too often, people either forget or don't know that Java is more than just a programming language. Actually, the most important part of Java may be the virtual machine. It provides the binary portability that makes Java so important in network environments, and where would Java be without the Internet? That is why I chose to start with The Java Virtual Machine Specification.
One way of looking at the JVM is to think of it as just another 32-bit CPU. It has many of the same components, including an instruction set, registers and the ability to do common operations on a similar set of data types. In many ways, The Java Virtual Machine Specification is like a reference manual you would get from a major CPU manufacturer—it contains an instruction reference and other reference material.
However, just as the JVM isn't exactly like most CPUs, The Java Virtual Machine Specification isn't exactly like most CPU reference manuals. It is a well-written book that is more than just instruction set references and explanations of the data types. This book (excluding the instruction set reference) can be read straight through and enjoyed. For example, Chapter 7 provides a very interesting tutorial called “Compiling for the JVM”. Not only would this be useful to compiler writers, but it would give any Java programmer insight into what his code is really doing. Actually, the book presents this information so well that it might encourage people, who wouldn't otherwise do so, to write useful bytecode utilities.
The book begins with a short and unexceptional introduction. It consists of a one-page history of Java, a one-page introduction to the virtual machine and a very brief chapter summary.
Chapter 2 is titled “Java Concepts”, and it summarizes the features of the Java programming language. The next chapter details the structure of the Java Virtual Machine. Data types, registers, stacks and many similar concepts are defined. The class file format and instruction set are introduced towards the end of Chapter 3.
In Chapter 4, the class file format is defined. Like most file format descriptions, a pseudo-code data structure is given which shows how the data are arranged in the file. Each field in this structure is described in an easy-to-understand and thorough manner.
Constant pool resolution is the topic of Chapter 5. The constant pool is similar to the symbol table found in conventional languages. In Java the constant pool allows the instruction set to refer to objects with a pair of bytes instead of the full name. In addition to describing the reason for the constant pool, the chapter explains how it is used in the process of loading, linking and initializing class files.
The instruction set for the Java Virtual Machine is found in Chapter 6. A short introduction is followed by 180 pages of well- organized bytecode descriptions.
Chapter 7 outlines the process of compiling source code to the JVM. This is done with examples of Java source code and the corresponding JVM bytecodes. The authors then describe how and why the compiler generated the bytecodes it did. Many examples in the chapter describe everything from compiling a simple for loop to throwing and handling exceptions.
The Java Virtual Machine Specification is a very useful book that is well worth reading. Although it is fundamentally a reference, it is remarkably easy to read. Therefore, I recommend it to anyone who wants to know more about the low-level workings of Java.
Title: The Java Language Specification
Authors: James Gosling, Bill Joy and Guy Steele
The Java Language Specification defines the Java programming language. For those of you who are trying to learn the Java programming language, you should know that this book is not a tutorial. It is a reference that includes every possible detail of the Java programming language.
In addition to defining the structure of the language, The Java Language Specification has numerous code samples that help illustrate specific rules. These are very helpful, especially since the descriptions often favor syntactic precision over human understanding.
The introduction consists of a quick description of Java and a chapter summary. It is followed by a brief chapter describing the grammar the rest of the book uses to explain the Java language.
The lexical structure of Java is described in Chapter 3. It begins with some notes on how Java uses Unicode, then goes into the low-level parsing of the source code files. This includes the definition of things such as white space, identifiers, keywords and so on. The chapter ends with a definition of the various types of literals, separators and operators.
“Types, Values and Variables” (Chapter 4) defines the various types that are available in Java. Primitive types are discussed first, including the ranges and operations of the integer, floating-point and boolean types, then reference types are defined. Since references deal with objects, some of the more primitive objects are outlined, including the class Object and class String. The chapter ends with a summary of the seven different types of variables in Java.
“Conversions and Promotions” (Chapter 5) defines the ways that the type of a variable can be changed. Conversions on both primitive and reference types are defined, as is the unique string conversion.
Chapter 6 defines the concept of a name in Java. Names are used to refer to packages, classes, members of an object and variables. The concepts of scope, inheritance and access control are also defined to the extent that they are used in naming.
In Java, classes can be organized into groups based on their functionality. These groups, called packages, are defined in Chapter 7. Included in this chapter are conventions for the naming and storing of packages.
Classes and interfaces are described in Chapters 8 and 9. These chapters provide good descriptions of all aspects, from keywords that modify classes and interfaces to the workings of inheritance and overloading.
Chapter 10 describes how arrays work in Java. The chapter begins with the assertion that arrays are objects, but of a distinct type. The chapter describes how arrays are similar to and different from other objects.
Exceptions are defined in Chapter 11. The chapter begins with a basic description of how the language constructs interact with the Throwable objects. It moves on to the causes of exceptions, and the end of the chapter describes all the exceptions the programmer will face.
Chapter 12 defines in an interesting way how the language interacts with the Java Virtual Machine. It begins with a description of what the virtual machine does when it is starting up. It moves on to a description of the loading and linking of classes, and ends with a description of how the virtual machine exits.
Probably the most interesting chapter of the book is Chapter 13. It describes in what ways old class files should remain compatible with new class files. The authors give many examples of code that should be binary compatible and how to make sure they are.
Chapters 14 and 15 describe the more traditional aspects of the Java language. The statements are defined, and then the way in which they are executed is outlined.
In Java, a value must be assigned to a local variable before it can be used. This is called “definite assignment” and is the topic of Chapter 16. It is very slow reading and will most likely be best used as a reference.
Threads and locks are introduced in Chapter 17, beginning with a description of how things differ when more than one thread of Java code is executing at a time. The chapter ends with some examples of situations that make multi-threaded code difficult, and the corresponding Java constructs that can solve the problems.
Java takes the two comment styles present in C++ and adds a third. This new comment style allows class interfaces, hierarchies and programmer documentation to be turned into web pages. Chapter 18 gives a description and an example.
Chapter 19 lists the LALR(1) grammar—probably of tremendous interest to compiler writers.
Finally, the book ends with an API reference that covers the java.lang, java.util and java.io packages. These are the core packages that must be present in all Java environments. They are covered in a bit more detail here than they are in The Java API.
The Java Language Specification is a good language reference. However, I don't think most people need a book this specific. I recommend it primarily to compiler writers or anyone else who is building a language-based tool.
Title: The Java Application Programming Interface, Volumes I & II
Authors: James Gosling, Frank Yellin and The Java Team
Price: $38.75 each
ISBN: 0-201-63453-8, 0-201-63453-7
The Java API is a reference book describing the classes that are part of the Java Development Kit. It is fairly simple and doesn't contain very detailed descriptions.
The book is split into two volumes sold separately. Volume I contains “Class Hierarchy Diagrams”, “Package java.lang”, “Package java.io”, “Package java.util” and “Package java.net”. Volume II contains “Package java.awt”, “Package java.awt.image”, “Package java.awt.peer” and “Package java.applet”.
I have a hard time recommending The Java API. There are now several books that are better deals. The Class Libraries is basically a superset of The Java API with more information about the way the classes work, and it includes numerous code samples. Or, if you are looking to save some money, you might want to get Java in a Nutshell by O'Reilly and Associates. It has a very nice, albeit small, API reference and only costs $20. It is my favorite Java book and is nice and soft from nearly a year of constant use.
Title: Concurrent Programming in Java
Authors: Doug Lea
Although there are many Java books out there, I haven't found many that use Java to teach an advanced programming concept. Concurrent Programming in Java is one of the few. I have always been aware of Java's concurrency mechanisms, but this book taught me how they can be used for real work.
The introduction is much better than those of the other four Java books reviewed here. First, the author lists some advantages and limitations of concurrency. Then the purpose of the book is given, followed by a typical chapter summary and a description of Java's concurrency mechanisms.
Chapter 2 defines the concept of safety with regard to concurrent programming; it outlines the methods by which multiple threads can execute on the same data so that “nothing bad ever happens”. These methods include using immutable objects, synchronization and containment.
Liveness could be considered the opposite of safety. Chapter 3 describes liveness problems and methods that can be used to solve them.
Chapter 4 covers the concept of state-dependent action. The author describes many possible actions that can be taken when a set of states is reached.
Concurrency control is covered in Chapter 5. Three approaches to concurrency control are covered. Examples are shown using Java, but the concepts are useful in any language.
Chapter 6 is titled “Services in Threads”. It explains how common tasks can be separated into threads. At this point the book becomes really interesting, because the reader can see how the concurrency concepts can work in real programs.
Chapter 7 describes how the flow policies implemented by a program affect safety and liveness issues. Finally, methods of coordinating more independent objects are outlined in Chapter 8.
Concurrent Programming in Java is a very good book. It is nice to see a book go into the details of a subject that hasn't already been beaten to death (the Applet class, for example).
If you have a lot of experience doing multi-threaded programming, you may find Concurrent Programming in Java a bit too simple and vague. Probably all you need is a description of Java's concurrency mechanisms. However, if you have little or no experience making concurrent programs, this book has a lot to teach you.
|Silicon Mechanics Gives Back||Jul 30, 2014|
|Reglue: Opening Up the World to Deserving Kids, One Linux Computer at a Time||Jul 29, 2014|
|diff -u: What's New in Kernel Development||Jul 23, 2014|
|Great Scott! It's Version 13!||Jul 21, 2014|
|Adminer—Better Than Awesome!||Jul 17, 2014|
|It Actually Is Rocket Science||Jul 16, 2014|
- Silicon Mechanics Gives Back
- Reglue: Opening Up the World to Deserving Kids, One Linux Computer at a Time
- Numerical Python
- NSA: Linux Journal is an "extremist forum" and its readers get flagged for extra surveillance
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Linux Systems Administrator
- diff -u: What's New in Kernel Development
- Tech Tip: Really Simple HTTP Server with Python
- Senior Perl Developer
- Technical Support Rep