Representing Context-dependent Behavioral Variations


Software systems must adapt to changing contexts over time, even while they are running. Unfortunately mainstream programming languages and development environments do not support this kind of dynamic change very well, leading developers to implement complex designs to anticipate various dimensions of variability.

The notion of Context-oriented Programming (COP) directly supports variability depending on a large range of dynamic attributes. In effect, it should be possible to dispatch runtime behavior on any properties of the execution context. First prototypes have illustrated how multi-dimensional dispatch can indeed be supported effectively to achieve expressive runtime variation in behavior.

Different COP languages or systems may provide different interpretations of the following mechanisms, but should at least address the following requirements:

More research and experimentation is clearly needed into different ways to compose and trigger variations. For example, variations may be expressed not only as differences in code, but as extensions, wrappers, advice, refactorings, or general transformations. Variations may not only be triggered explicitly and programmatically, but also implicitly by means of rules or constraints. Important questions include how existing development approaches can be adapted and extended to support COP, starting from analysis over design up to implementation.

One compelling application domain for COP is to control software evolution. COP can enable runtime deployment of software changes while strictly delimiting the visibility of changes to specific clients and leaving others untouched. Radical changes can slowly percolate through a running system, without breaking clients who are not ready for them. Backwards-compatibility need no longer be a critical concern if the client context is taken into account when deploying changes. Global consistency is neither assumed nor desirable.

COP signals a move away from application-specific solutions to runtime variability (such as those offered by many design patterns), and instead focuses on developing a new programming paradigm and corresponding language constructs and underlying software infrastructure to support context-dependent behavior. We believe that these steps are essential to achieving the high degree of maintainability, robustness and adaptability that is needed for the emerging breed of dynamic, mobile and pervasive applications.

Most of the existing approaches for handling context-dependent software behavior have been embedded in other research domains, such as object-oriented programming, aspect-oriented programming, feature-oriented programming, productline architectures, ambient intelligence, unanticipated and/or dynamic software evolution, dynamic languages, and so on. However, it is about time to recognize and appreciate a focus on context orientation as a common thread.