TU August 2, 16:00 - 16:45
Demonstrations

D6 — Recent Developments in Context-oriented Programming

Pascal Costanza (VU Brussel, Belgium), Robert Hirschfeld (Hasso-Plattner-Institut, Germany)

Abstract

There is an increased need for context-aware applications that can dynamically adjust their behavior to the context of their use. Two years ago, we have introduced ContextL, our first programming language extension that explicitly supports Context-oriented Programming (COP). In COP, programs consist of partial class and method definitions that can be selected and combined at runtime as needed. Employing runtime adaptations to class and method definitions, COP does not only allow expressing context-aware behavior, but encourages continually adjusting behavior of programs according to their context.

With contemporary mainstream programming languages, the only way to introduce context-dependent behavior into a program is either by inserting if statements wherever necessary, violating one of the fundamental principles of object-oriented programming, namely to avoid explicit conditionals for achieving polymorphic behavior, or else by using design patterns to factor out the context-dependent behavior. Both approaches lead to unnecessarily complicated code that is hard to comprehend and even harder to maintain.

With COP on the other hand, we can modularize behavioral variations of a software system into layers. Layers are composed into or out of the system depending on the context apparent during program execution. We extend this idea by the notion of dynamically scoped layer activation, resulting in a viable approach to the expression of context-dependent behavior.

Since then, we have carried out a number of successful application and language extension experiments which show that the basic building blocks (layers and scoped activation) remain stable cornerstones in context-aware systems. Among others, we have implemented multiple context-dependent views on the same object, coordination of screen updates, discerning of phone calls based on the context of both callers and callees, and selecting context-dependent billing schemes. ContextL has also already been integrated into Lisp on Lines, a Web framework that is used in commercial applications. In other settings, we have developed ContextS for Smalltalk/Squeak, and context-oriented extensions of AmbientTalk. We have also taken first steps towards supporting the design and the requirements engineering phases to address the specific needs of context-aware applications.

In our demonstration, we will show and discuss the following.

  • The basic language constructs for Context-oriented Programming.
  • The development of comprehensive non-trivial examples.
  • The current state of the art in COP: language extensions, example applications and support for the various stages in software development.
  • Future work: promising next steps that several researchers in our own groups and elsewhere

are currently undertaking.

Maintained by webmaster · Version of June 25, 2007 Valid XHTML 1.1