Manning Logo
Home | Ordering Info | Shopping Cart | Manage My Account | Login
Attention customers: online shopping is now available exclusively through our main website: http://www.manning.com. Thank you.
Java Reflection in Action

Inside the book

About this Book Sample Chapters Table of Contents Index Preface Book Reviews Source Code Author Online

Manning Blog

Why small is sweet?

Author Blogs

Dave Crane more...

Author Calendar

Upcoming Events

Catalog

Java .NET Perl XML All by Subject All by Title

About...

Manning Contact Us Ordering FAQs ebooks Covers Sandbox Forums Distributors Manning Early Access Program (MEAP) Affiliate Program Academia/Publicity User Group Program Press Releases Jobs

Manning Publications Co.
209 Bruce Park Avenue
Greenwich, CT 06830

Java Reflection in Action
Ira R. Forman and Nate Forman

2004 | 300 pages
ISBN: 1932394184
$22.50 PDF ebook  
$44.95 Softbound print book  

Preface

Preface

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.

[1]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).

[2]This term refers to the four authors of Design Patterns: Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides.

DESCRIPTION

You are a Java developer. You are asked to add a simple feature to your application. But "simple" can be deceiving: you have to make many changes, in locations which can be difficult to find.

If this sounds familiar, you want to know about Java reflection. With reflection, you can work smarter by designing flexible applications to which you can easily add likely new requirements. Then, with a few code changes in easy-to-find places, you've got the job done. Reflection adds a new dimension to your programming skills. It will boost your effectiveness.

Java Reflection in Action starts from the basics. It gradually builds a complete understanding, adding as it goes reflective concepts illustrated with many small examples that are useful in real applications.

In a subplot, the book follows a programmer, George, as he tackles common but difficult tasks. In each case, George finds flexible, reflective solutions that replace the usual hard-coded ones. The power of reflection becomes clear through his story.

What's Inside

  • Introduction to reflective programming
  • How reflective code generation can address common cross-cutting concerns
  • How to load new classes dynamically into a running application
  • How to decide when reflection is the best solution

WHAT THE EXPERTS SAY ABOUT THIS BOOK...

"Contains the best description of Java's dynamic proxies that I've ever come across, and also has notes on the relevant new features in Java 1.5. ...required reading for anyone who's serious about making Java work for them."
-- Dr. Dobb's Journal

"Valuable, both for the professional software developer, and for academics and students who wish to better understand this aspect of object-oriented programming."
-- Computing Reviews

"Exceptional coverage of an area of Java programming that is generally poorly covered and often misunderstood. 10 horseshoes."
-- JavaRanch.com

ABOUT THE AUTHORS...

Dr. Ira Forman is a senior software engineer at IBM. He started working on reflection in the early 1990s when he developed IBM's SOM Metaclass Framework. Nate Forman works for Ticom Geomatics where he uses reflection in day-to-day problems. Ira and Nate are father and son. They live in Austin, Texas.

Home | Catalog | Privacy Policy | About Manning

© 2003-2006 Manning Publications Co.