Our research on computational reflection was initially motivated by our willingness to verify the use of MOPs as a tool for structuring and building environments for fault-tolerant distributed programming. We intended to design and implement a library like MOLDS [19], a library of reusable and combinable meta-level components useful for distributed applications, such as persistence, distribution, replication and atomicity.
Unfortunately, none of the existing reflective architectures supported composition of meta-objects in a way that fulfilled our needs. Therefore, we started the development of Guaranį. This paper is an effort to convey the positive and negative aspects of this experience.
Guaranį provides a powerful and secure mechanism to combine meta-objects into dynamically modifiable, elaborate meta-configurations. In addition to enforcing a clear separation between the reflective levels of an application, the MOP of Guaranį improves reuse of meta-level code by defining a meta-object interface that eases flexible composition. Furthermore, it suggests a separation of concernts between meta-objects, that implement meta-level behavior, from composers, that define policies of composition and organization.
The implementation of the reflective architecture of Guaranį required some modifications in a Java interpreter, but not in the Java programming language. Thus, any program created and compiled with any Java compiler will run on our implementation, and it will be possible to use reflective mechanisms in order to extend them.
Our modifications have reduced the speed of the interpreter, but we believe the flexibility introduced by the reflective capabilities outweighs this inconvenience. Furthermore, the performance impact analysis has revealed the current hot spots in the interception mechanisms. We expect to reduce this impact by implementing the suggested optimizations.
Now that we have Guaranį, we are concentrating our efforts on the design and implementation of MOLDS. The interaction of the various mechanisms foreseen for MOLDS will fully demonstrate the power of our MOP. Meanwhile, other projects based on Guaranį are demonstrating its flexibility and ease of use. Tropyc [1] is a pattern language for the domain of cryptography, that is currently using Guaranį in order to transparently introduce cryptographic mechanisms in electronic commerce applications. The composition strategy of Guaranį has also supported the implementation of the Reflective State Pattern and of its adaptation to the domain of fault tolerance [3,4].
A last evidence of the usefulness of our approach is the possibility of creating a reflective ORB by simply running a 100% Pure Java ORB in Guaranį. By doing this, we provide to the users of the ORB the ability to create reflective middleware and applications, with a development cost close to zero.
The experience with the design and implementation of Guaranį and related applications allows us to conclude that initiatives by the software industry to build software that is highly adaptable and reusable should incorporate MOPs as flexible as, and at least as efficient as the one we have described.