We wrote this book because reflection inspires us. It produces solutions so elegant that they elicit the same sense of wonderment that we often felt as children. It is this inspiration that has driven both of us in our study and practice of reflective programming over the last ten years.
In the early 1990s, Ira Forman was a member of the development team for IBM's SOMobjects Toolkit, generally known as SOM. It was not a programming language. Rather, SOM was an API to a highly capable and reflective object model.
For the second release of SOM in 1994, Ira and Scott Danforth wrote the Metaclass Framework, which used the reflective facilities of SOM to provide useful tools for the rest of the development team and the IBM customers. This may well be the first commercial instance of what has become known as Aspect-Oriented Programming. Included in the Metaclass Framework was a tool to dynamically create proxy classes. Another tool could wrap the methods of a class with code to execute before and after every method execution (this was the way the trace facility was created without modifying the SOM kernel). Yet another modified a class to be a singleton. In addition, there was a metaclass to support the conversion of plain-old classes into replicated classes (in the context of the SOM Replication Framework, which was programmed by Hari Madduri and Ira). These experiences convinced Ira that reflective programming is cool.
Despite all of its technical innovation, SOM was not a financial success.1 In 1996, Java pushed SOM out of the marketplace. Allowing those innovations to be lost was unacceptable. So, while employed to work on other matters, Ira and Scott pushed on to write Putting Metaclasses to Work, which was published in 1999.
About that time, Ira's son Nate was looking for a topic for a master's paper at the University of Texas at Austin. Nate accepted Ira's suggestion: study the use of reflection to support the application of Gang-of-Four2 design patterns. The resulting paper led to some interesting insights into both reflection and patterns. But most of all, it reinforced our conviction that reflective programming is cool.
Nate graduated and went to work as a Java developer, first at Liaison Technology and currently at Ticom Geomatics. Nate was able to leverage Java reflection to the benefit of his employers, producing flexible application frameworks and APIs. These experiences proved to us that reflection is more than cool-it's valuable.
With this value in mind, we teamed up to teach reflection. In 2001 and 2002, we taught a course titled Software Patterns, UML, and Reflection as part of the Software Engineering Program at the University of Texas. Also, each October since 2001, we have presented a Java Reflection tutorial at the OOPSLA Conference.
One of our OOPSLA traditions is to have dinner with John Vlissides. At the first dinner, John asserted, "You two should write a book," and went on to suggest a stimulating topic. This father and son team will be forever grateful for that suggestion.
We hope that, through this book, you will find Java reflection as cool and valuable as we do.
SOM was IBM's product to compete with Microsoft's COM for control of the architecture of object-oriented programming. Both SOM and COM were designed on the assumption that the world needed a better C++. The world, however, wanted something else, as was evident by the astoundingly rapid rise of Java to preeminence in object-oriented programming. In 1996, SOM exited the marketplace, but, with its bigger market share, COM survived. Now, the battle for control of the architecture of object-oriented programming has moved to C# versus Java. Control of an architecture is where the big money is made in information technology. In the 1980s, IBM ceded control over the hardware architecture of personal computers to Intel; as a result, today we speak about "Intel inside" and not "IBM compatible." For more information about the importance of controlling an architecture, see Computer Wars: How the West Can Win in a Post-IBM World by Charles H. Ferguson and Charles R. Morris (Random House, 1993).
This term refers to the four authors of Design Patterns: Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides.