Runtime Support for Type-Safe and Context-Based Behavior Adaptation

Yinliang Zhao, Changpeng Zhu, Bo Han, Qinghua Zeng · 2012

Context-awareness has become increasingly important for mobile and ubiquitous computing. However, current mainstream object-oriented languages provide little explicit support for context-awareness. Object composition and delegation are often advocated as a flexible approach to represent dynamic behavior of objects with some dynamic behavior. In this paper, we propose Dynamic Behavior Adaptation Featherweight Java (DBAFJ), an extension of Featherweight Java with object composition and delegation, to support for context-awareness. In DBAFJ, each layer consists of a set of layered classes and a predicate method. The former defines a set of context-specific methods, and the latter describes a specific context. Instances of layered classes are created by the runtime system and are specialized in object composition that is context-based. Objects can be adapted by object composition at runtime to obtain new context-specific methods, and delegation with a static type discipline ensures that these new methods are correctly executed. Therefore, DBAFJ supports that the program dynamically adjust its behavior to the current execution context. The sound type system of DBAFJ assures that no "message-not-understood" errors occur at run-time.

Read the paper · More papers on PaperTik