A concrete base class, Subject, provides mechanisms to dynamically
add and query for extensions. A given extension must be
downcast to its specific interface (SpecificExtension) for use. The
pattern as a whole amounts to defining a standard way to cross
cast from one interface reference to another.
The aspect-oriented alternative to extension objects is extension
aspects (Figure eight). This approach eliminates the need for client
cross casting from one extension (or base interface) to another by
directly injecting the implementation of a specific interface into a
class seen by a given set of clients. Besides removing the cross
casting from client code, this approach reduces the run-time
overhead of the cross cast and the design complexity as measured
in number of classes and methods. The core functionality is more
reusable since its extension mechanism is not predefined via
inheritance from Subject and dependence upon Extension.