Dynamic Ordered Inheritance and Flexible Method Dispatch
The aim of component-oriented programming is to construct large software applications out of sets of small components with low complexity, rather than building monolithic applications which usually are difficult and expensive to maintain and extend. This enables rapid applications development, makes maintenance easier, and therefore also reduces development costs.
Using third-party components further reduces the efforts, but it also has its shortcomings. Developers are often confronted with the lack of flexibility of third-party components to be adapted to their needs. Companies offering components are confronted with the problem to anticipate how developers (customers) and users might want to adapt the components. They have to build in hooks that allow to customize and extend the components.
The other way is to offer a solution that allows developers and users to dynamically modify components without being limited to a few hooks. However, current approaches for component modification are still not satisfying or sufficient. The support is often only available at compile- or link-time. Current approaches that provide generic (unanticipated) support for dynamic component modification are not sufficient.
This thesis presents a small framework wich supports dynamic component modification through a flexible method dispatch mechanism. Method dispatch is the mechanism for delegating a method call from the object where the method has been invoked to the object, respectively class where the method is implemented. The framework also provides proper base classes and template configurations for components, which can help to significantly simplify development of applications and their components. The framework is called PCoC which is the abbreviation for Prioritized Coupling and Control of objects and components. Many of its concepts and facilities can also be deployed independently of each other if necessary.
We use a reflection-based (meta-programming) approach where operations are treated as first- class objects. So-called Dispatchers, similar to the Microsoft .NET delegates (type-safe method- pointers), are responsible for dynamic method dispatch.The approach enables to add, remove, or replace operations at runtime, and to attach listeners to method objects, which are notified before or after each call. It simulates delegation-a dispatch mechanism in which an object (the receiver) delegates a message to another object (the method holder and delegate) in response to a message. The delegate carries out the request on behalf of the original object, and may send subsequent messages to the original receiver. This includes the invocation of methods.
A priority ranking of components determins in which order requests for operations are forwarded, which gives the framework its name PCoC. This ranking can change through user interaction (focus change in the GUI), or explicitly.
There are implementations of PCoC in C++ and Java. These are parts of two integrated development environments (IDEs) available on various platforms, including Sun Solaris, Linux and the Microsoft Windows NT line.
PhD thesis, Johannes Kepler University Linz, Juli 2003