Skip to Main Content
Object composition is often advocated as a more flexible approach to specialize the behavior of objects dynamically. In this paper, we propose Dynamic Object Evolution Featherweight Java (DOEFJ), an extension of Featherweight Java with object composition and consultation, to support dynamic behavior adjustment of the program. In DOEFJ, instances of layered classes are created at run-time by the runtime system and are specialized in object composition. According to the current execution context, objects can be evolved by object composition to obtain new context-specific methods. A consultant based mechanism ensures that these new methods are correctly executed. With these mechanisms, the DOEFJ program can dynamically adapts its behavior to the current execution context. The sound type system of DOEFJ assures that no “message-not-understood” errors occur at run-time.