Extending Context-oriented Programming to new Application Domains: Run-time Adaptation Support for Java
Program behavior that relies on contextual information, such as physical location or network accessibility, is common in today’s applications, yet its representation is not sufficiently supported by programming languages. With context-oriented programming (COP), such context-dependent behavioral variations can be explicitly modularized and dynamically activated.
In general, COP could be used to manage any context-specific behavior. However, its contemporary realizations limit the control of dynamic adaptation. This, in turn, limits the interaction of COP’s adaptation mechanisms with widely used architectures, such as eventbased, mobile, and distributed programming. For example, most graphical user interfaces provide event listeners for user interaction. Currently, to combine them with COP, we must declare our adaptation at each listener, which results in a redundant and scattered implementation. Also, current COP implementations do not acknowledge applications leaving their local environment, such as Web service-based programs. In these cases, adaptation information is not taken into account.
In this thesis, we conduct case studies to analyze these issues and develop an extension of COP to increase control over behavioral variations. This extension includes, among other features, the combination of context-oriented language constructs with elements of a domain-specific aspect language. For proof of concept, we implement JCop, an extension to the Java programming language, and redesign the programs of our case studies using JCop language features. As a result, these redesigned implementations are more concise and better modularized than their counterparts using plain COP.