About the Author
null
Spotlight Features

The Rich Engineering Heritage Behind Dependency Injection

Andrew McVeigh takes us on a tour of the rich heritage behind dependency injection, what it represents, and tells us why its here to stay.

Java, the OLPC, and community responsibility

The "One Laptop Per Child" project has a great device ready to ship, but there's no Java on there. Let's think about working together to put Java on OLPC!

Eclipse Rich Client Platform : Designing, Coding, and Packaging Java(TM) Applications

Authors: Jeff McAffer, Jean-Michel Lemieux
Publisher: Addison-Wesley Professional
Date of publication: October 11, 2005
Sample Chapter: Chapter 2
Reviewer: Wayne Beaton

Review:

The first great thing about this book is how much useful information it provides about building applications using the Eclipse Rich Client Platform (RCP). The second great thing about this book is that it is really easy to read and that's rare in books that provide this level of technical detail.

The book is divided into five parts. In part I, the concept of rich client is introduced along with a little history describing where the RCP came from. Part I also provides some useful background with regard to the notion of an Eclipse product being composed of multiple bundles/plug-ins all working together. The OSGi framework that provides the component model underneath Eclipse (and RCP) is also described; OSGi is discussed throughout the book and, in particular, part V which contains reference materials.

Part II, containing chapters 3 through 14 is a tutorial. These chapters step the reader through the process of building a first RCP application. The example application is built incrementally with each step in the evolution of the application resulting in executable code. I'm grateful that the authors chose this approach as I think it adds an entirely unexpected (by me) benefit of showing the reader how they might approach the construction of an RCP application using agile development techniques (though even readers who are not considering agile development techniques will benefit from the material).

Chapters 3 through 8 step through the process of building the look and feel of the example application. In these chapters, a collection of views and editors is built. Much of the material in these chapters is useful to anybody building user interface components for any kind of Eclipse plug-in; this comes as no surprise as there is fundamentally no distinction between Eclipse tool plug-ins and Eclipse RCP plug-ins. These chapters also discuss branding your application; branding allows you to hang your own images and icons on your application.

Chapter 9 walks through the steps required to export the application on multiple platforms. That is, it shows you how you can build your application on one platform and deploy to many. The export process is done exclusively using the IDE; chapter 24 describes how you can create an automated build process composed of Ant scripts using the Plug-in Development Environment's (PDE) Build.

At the start of the tutorial (chapter 3), a recommendation is made that a separate target platform be created. The target platform is (essentially) an Eclipse configuration that contains the minimal set of plug-ins that Eclipse will build an plug-ins against. By default, Eclipse is configured to use itself as the target platform which gives your RCP plug-ins potential access to everything loaded in your IDE. By setting up a special target platform, you can take direct control over the set of plug-ins your RCP application can potentially have access to and even have your RCP application target different plug-in versions than are currently loaded in your IDE environment. Theoretically, this all sounds like goodness. Unfortunately, this exposes a weakness in RCP. The RCP SDK that the book recommends you download and use to create your target directory contains a relatively small subset of the plug-ins available. If you require more functionality from the Eclipse project than is provided by the RCP download, you will need to augment your target platform. This is, unfortunately, a completely manual process and can be quite painful: as you drag in the plug-ins you require, you have to also recursively include the plug-ins that that those plug-ins require. Of course, since you've configured your workspace to use the RCP target platform, it can't help you: it doesn't know about the plug-ins that are not included in the current target. I found that having a second open instance of Eclipse with a default configuration made things a little easier (but still primarily manual).

In the end, if you need to use more than just the subset of plug-ins provided by the RCP SDK, it might be a good idea to start from a bigger base. That is, start with the entire platform SDK and anything else you might need (EMF, GEF, etc.).

By the end of chapter 9, the look and feel of the application is more-or-less completely built, but the application has no really useful behavior. That's what gets started in chapter 10. The application built through the tutorial is an instant messaging client named Hyperbola and in chapter 10, the libraries that provide the actual instant messaging behavior are included. Following the iterative development notions established in early chapters, this chapter leans heavily on the refactoring tools included with Eclipse's Java Development Tools (JDT). Again, this is a great chapter to read to learn about RCP, but it is also a great chapter to learn more about agile development and refactoring (all software developers should be required to read Martin Fowler's "Refactoring" book, but that's the focus of a different book review).

Initially, I wasn't happy with the example chosen for the tutorial. I'd prefer to see something a little richer domain that demonstrates the real power of RCP. However, having spent many years myself building education offerings, I know that finding a good idea for examples or labs can be difficult. While it might have been nice for the book to focus on building something really meaty like a customer relationship management (CRM) application, there is danger in selecting a domain that overshadows the real focus of the book. So, in retrospect, I've decided that I quite like the example domain. Besides, it does provide ample opportunity to demonstrates the kinds of interactions you can have with RCP.

Chapter 10 covers a lot of useful material. There is a discussion on the legal implications of bundling third party software. In the case of Hyperbola, the third party software in question is Smack, an Extensible Messaging and Presence Protocol (XMPP) client. The discussion around licensing is brief, but I'm happy that it's there. It's important that we consider licensing issues, but a full discussion of licensing is way beyond the scope of the book.

There is also the start of a conversation in section 10.2.2 around decoupling. The Smack library has its own object model and a decision needs to be made: should the library's object model be used, or should the plug-in create it's own object model? In the case of Smack, either by design or by chance, the object model provided lines up almost exactly with what the plug-in needs to do and the authors decided to leverage the Smack object model directly in their code. I'd have probably gone the other way and have worked toward decoupling the library from the plug-in. This isn't a criticism of the authors' decision, but rather a difference in opinion. I'd have loved to see the book discuss this issue a lot more as I'm sure it's a big issue that will be faced by RCP developers. Still, I guess the omission gives me something to write about in my book: coming sometime this decade to stores near you.

By the end of chapter 10, Hyperbola is a functioning chat client. The balance of part II is concerned with filling in the rest of the application by adding such things as key bindings and help. It's all great stuff that's useful to anybody building user interface components for Eclipse (RCP or not). Chapter 14 is concerned with providing update functionality for your applications. This is one of the key elements of rich client technology. While the application is intended to be installed on the client desktop, it does not have to be a monolithic unchanging application like those we build back in the "fat client" days. Chapter 14 steps through the process of defining features for use with the Eclipse update manager (and the process of including the update manager plug-ins which are not part of the base RCP download). The chapter is concerned with enabling an RCP application to make use of the update manager's UI components to make it easy for the user to update the application. This is all good stuff, but I'd have liked to see some discussion of making updates that are completely transparent to the user. While chapter 21 later discusses update manager with some more detail, it doesn't get into this area.

Part III is concerned with providing a lot more detail on the topics covered in earlier chapters. While the tutorial's main focus is that of getting something to run, chapters 15 through 19 are concerned with making the reader understand what each of the parts actually does and how you can use the various advisors and configurers to tune the look and behaviour of the application. There are a couple of code samples in this part of the book that I had to read a couple of times before I could understand their purpose, but I think that this is more a function of the authors' coding style being different from mine than an indication of a particular problem. Frankly, I expected to have to pay a little more careful attention while reading these later chapters.

I found chapter 18 fun to read as it shows how to build windows with arbitrary shapes (i.e. non-rectangular). It's nice to know that Eclipse provide us with the tools to build whatever kind of gaudy user interface we desire.

The chapters in Part IV are great reference materials for the inner workings of Eclipse. Chapter 20, for example, tells you everything you might want to know about classloading and the many problems associated with it. If you're having trouble getting Log4J to find your appenders, or Hibernate to find your object model, you need to read this chapter. Chapter 22 discusses the issues of building plug-ins that can be dynamically loaded and unloaded. Ideally, all plug-in should be dynamic, and so this chapter is a must-read for anybody building plug-ins of any description. As is a common theme with this book, these chapters are great reference materials for anybody writing plug-ins for Eclipse, whether they end up as part of a rich client application or not.

Chapter 23 starts the process of tying up all the pieces and introduces a collection of five rules you need to keep in mind while building Eclipse plug-ins. This chapter discusses important concepts like factoring your application into multiple plug-ins. This is (in my opinion) pretty important stuff, and I am a little worried that such important information is left to the end of the book. On the plus side, most folks tend to more easily recall the last bits of information they learn; on the negative side, I'm concerned that some people might stop reading after they've gotten the basics of RCP nailed down in chapter 14. At any rate, it's good information, and (again) something that everybody building Eclipse plug-ins should read.

The reader is taken through the process of actually delivering an RCP application to end-users in chapter 25 as part IV closes.

The rest of the book falls into part V and is exclusively reference material. Chapter 26 provides a good overview of OSGi, and chapter 27 wraps up with an discussion of where and how to find useful and interesting plug-ins that you can include in your RCP application.

Overall, I am impressed by this book for two reasons. First, it provides much needed high-quality documentation for building RCP applications. Second, it provides the information in an almost casual easy-to-understand manner. I was literally able to read half of this book in one sitting. The other half took a little longer, but that is to be expected as the last half of the book contains the more deeply technical material. I learned a lot about RCP by reading this book, but I also learned a lot about developing plug-ins in a more general sense. I recommend this book to anybody building any kind of plug-ins for Eclipse.

Check out the RCP book website.

Download Chapter 2

Purchase Eclipse Rich Client Platform on Amazon and help Javalobby.