Run-time Variability with Roles

Variability is one of the major requirements for software systems executed in highly dynamic environments. The degree of variability of a system is determined by the number of contexts it can differentiate, its ability to perform foreseen or unforeseen changes, the granularity of change operations, the point in time these changes can be performed and the roll back mechanism in case of incident after applying adaptation.

Existing approaches for dynamic bindings working on the language level offer run-time variability only to a certain extent. Aspect-oriented Programming (AOP) weaves cross-cutting concerns into an object’s code, uniformly adapting all instances of a given type, limiting the flexibility for rebinding variations, and not supporting unforeseen changes. Context-oriented Programming (COP) addresses the support of behavioral adaptation at the instance level based on layer activation. However, bringing both the anticipated and the unanticipated adaptation at the instance level is not directly supported. Role-oriented Programming (ROP) also provides a solution to support variability by encapsulating dynamic behavior, modeled as role, to be bound to and unbound from the player containing static behaviors dynamically. Existing ROP solutions bind roles at compile or load time, though they can be (de)activated at run time to achieve adaptation. Therefore, this imposes a challenge to bind other unforeseen roles at run time, resulting only in foreseen adaptation that is supported.

Based on the concept of ROP, we address the problem of run-time variability at the instance level, allowing both anticipated and unanticipated adaptation to coexist in a single solution. We introduce a mechanism called dynamic instance binding that maintains a data structure representing the binding information between player and role instances in a look-up table. That table is used to dynamically invoke the behavior of the role to which a player is currently bound. The mechanism is implemented as part of the runtime, called LyRT, supporting the execution of role-based software systems. Based on that implementation, we demonstrate that dynamic instance binding can support flexible (re-)binding of roles and object instances as well as the introduction of new roles without having to restart the system. Furthermore, binding relation stored in the look-up table can be enhanced to support versioning of the adaptable configuration which can be triggered to roll back and forward ensuring the consistency of the adaptation.