JavaBeans book review

We picked three winners -- now let's see how they stack up

1 2 Page 2
Page 2 of 2

Just past the halfway mark in the book is a seminal chapter ("Implementing Real-Life Beans") that walks readers through the complete cycle of requirements, design, and construction of a useful, high-quality JavaBean. The chapter takes the time to discuss the requirements for real-world beans, as opposed to including only simple book examples or toys that are cute but add little value to an application. It's astonishing to see an example program in a programming book include a requirements phase, when such a phase is often cut short in the software development world. An architecture for a RealTimeGraph bean is developed and discussed, and the standard sermon is delivered about the importance of requirements, analysis, and design before coding. After a lengthy description of the solution code, the author even presents a post-mortem on the design, and comes up with some ways to improve the bean.

In the sample bean chapter, visibility (whether a bean can or "wants to" present a visible interface, often a side issue) and localization (also known as internationalization, increasingly not a side issue) are covered through an example.

Reflection and introspection are treated in detail in this book, along with the related rationale for the type changes that accompanied JDK 1.1. The coverage of serialization is sufficient for JavaBeans designers. (RMI developers should look elsewhere for solutions to their thorny serialization problems.) Object replacement during serialization is not covered in this book, but Mastering JavaBeans includes the standard descriptions of how to code serialization and handle object versioning. As always, though, this book goes the extra mile to describe the serialization process in detail, spell out serialization stream formats at the byte level, and point out potential coding problems programmers may encounter.

Supporting material

A single appendix contains a package of utility methods that supports all of the code examples in the book. There is a miniscule glossary, oddly weak in such an otherwise comprehensive work. The index is extremely detailed, and there are references both by concept and by sample class name. Finally, there is a CD-ROM containing all of the source code from the book. Also on the CD-ROM are the JDK 1.1.1 and the BDK 1.1, which should be sufficient for the examples in the book, and for experimentation. The most recent versions of these products, though, should be downloaded from Sun's JavaSoft site (see Resources below for links).

The CD-ROM and glossary actually are a bit of a disappointment, but don't buy this book for the CD-ROM. Buy it because it's hands-down excellent. Throughout the book are "Warnings," "Notes," and "Tips," as well as sidebars on topics related to object-oriented software development, coding style, clarifications of Java features, and high-level design concepts. This book is geared more for the developer who will be developing JavaBeans or for JavaBeans builders than for a beginner just learning or evaluating the technology. But by and large, Mastering JavaBeans is one of the best technology-specific programming books I've ever seen.

Developing Java Beans by Robert Englander

Practically anyone who has done serious work with the Unix operating system will know and appreciate the O'Reilly Nutshell handbook series. These books have a well-deserved reputation for presenting arcane and at times extremely poorly-documented systems in a straightforward, accessible manner. O'Reilly now offers a Java series, and Robert Englander's Developing Java Beans (298 pages, O'Reilly and Associates) continues the tradition of quality and clean organization typical of all Nutshell books.

This book also begins with an introduction to the concept of a software component model, but does so in a way that is very Java-oriented. The first sample bean appears on page 5. The first chapter is a clear introduction to the standard JavaBeans concepts.

An easy, organized read

Throughout the book, the text is concise yet easy to understand. The first chapter on events includes a description of the delegation event model, event objects, event sources, standard and multiple-parameter listeners, unicast and multicast event propagation, multithreading issues, and AWT events. Most of these topics have at least some sample code, and all of this is presented in only 29 pages! The chapters that follow cover various types of event adapters and filters, the use of inner classes in event processing (one of their prime applications), and event queuing. The progression from simple, basic concepts to more complex topics is smooth.

Properties of various types (normal, bound, constrained, and so on) are covered in a single chapter with examples. Object serialization is covered well, with examples and explanatory text that follow one another in a logical, easy-to-follow fashion. The serialization chapter is especially valuable because it includes a section on serializing event listeners, an important topic that's easy to overlook (until your code starts throwing exceptions at you, that is.) A short but adequate chapter on the JAR file includes a link to a useful JAR file utility, moajar. (The link in the book is outdated, but see Resources below for a fresh link.)

There's a short chapter on using the BeanBox that's adequate to get you started. Midway through the book, the initial operational bean functionality is demonstrated by developing a temperature control simulator, constructed of several beans living inside an applet.

Following the chapter on applets is a chapter on introspection. Though the Introspector class is discussed, as one might expect, the chapter focuses mostly on the BeanInfo and descriptor classes, which a bean uses to communicate with its container, via introspection. The customization and property editor section is thorough yet succinct, and has a section on using property editors to generate Java source code. This is an interesting detail for bean builder developers that is not often covered in other JavaBeans books. A development tool that generates Java source code can ask a configured bean for the source code that would initialize the bean to its current state, and then dump Java code that initializes and interconnects beans (instead of simply creating a JAR file containing serialized beans).

Unique info: The ActiveX Bridge

Of the three books reviewed here, Developing JavaBeans is the only one that addresses the use of the ActiveX Bridge, Sun's technology for wrapping JavaBeans as ActiveX components. An actual example of how to use the Bridge is provided, and this chapter alone makes the book worth purchasing for anyone who wants a tutorial introduction to the Bridge. The example demonstrates how to wrap one of the example beans from the book as an ActiveX control, and then how to use that control in a Visual Basic program.

End matters

The book ends with two appendices, one on what Sun's JavaSoft division has unfortunately decided to call "Design Patterns" (which are actually naming conventions), and another with short but adequate annotated descriptions of the classes and interfaces in java.beans. The index is usable and complete. The endnotes also include a colophon, an elegant addition that appears in all Nutshell books.

A code caveat

Apparently, many of the code samples in the book itself are incorrect. O'Reilly has acknowledged and fixed the problem, and the corrected sample code is available at the publisher's Web site. See the Resources section below for a link to the new sample code.

Because this book is terser than many others, the treatment of concepts and sample code isn't as extensive as in other books. But if you're a quick study and want a book that cuts to the chase, Developing JavaBeans is an excellent choice. This book also makes a great resource for the programmer whose motto is, I either know how to do it, or I know where to find it.


I can heartily recommend all of the books reviewed in this column, with each book showing its greatest strength in the areas I've indicated. Mastering JavaBeans is the most complete and in-depth work, JavaBeans is excellent for a tutorial introduction, and Developing JavaBeans is great for programmers who want just the facts. Truly, though, any one of these books will serve you well for any of these purposes.

Mark Johnson has a B.S. in computer and electrical engineering from Purdue University (1986). He is a fanatical devotee of the design pattern approach in object-oriented architecture, of software components in theory, and of JavaBeans in practice. Over the past several years, he worked for Kodak, Booz-Allen and Hamilton, and EDS in Mexico City, developing Oracle and Informix database applications for the Mexican Federal Electoral Institute and for Mexican Customs. He currently works as a designer and developer for Object Products in Fort Collins, CO.

This story, "JavaBeans book review" was originally published by JavaWorld.


Copyright © 1998 IDG Communications, Inc.

1 2 Page 2
Page 2 of 2
How to choose a low-code development platform