Efficient Layer Activation for Switching Context-Dependent Behavior

Today’s programming platforms do not provide sufficient constructs that allow a program’s behavior to depend on the context in which it is executing. This paper presents the design and implementation of programming language extensions that explicitly support our vision of Context-oriented Programming. In this model, programs can be partitioned into layers that can be dynamically activated and deactivated depending on their execution context. Layers are sets of partial program definitions that can be composed in any order. Context-oriented Programming encourages rich, dynamic modifications of program behavior at runtime, requiring an efficient implementation. We present a dynamic representation of layers that yields competitive performance characteristics for both layer activation/deactivation and overall program execution. We illustrate the performance of our implementation by providing an alternative solution for one of the prominent examples of aspect-oriented programming.

[1]  Rachid Guerraoui,et al.  ECOOP’ 99 — Object-Oriented Programming , 1999, Lecture Notes in Computer Science.

[2]  Giovanni Vigna,et al.  Understanding Code Mobility , 1998, IEEE Trans. Software Eng..

[3]  Pascal Costanza,et al.  Dynamically scoped functions as the essence of AOP , 2003, SIGP.

[4]  Guy L. Steele,et al.  Common LISP: the language, 2nd Edition , 1990 .

[5]  Robert Hirschfeld,et al.  AspectS - Aspect-Oriented Programming with Squeak , 2002, NetObjectDays.

[6]  Jonathan Aldrich,et al.  Prototypes with Multiple Dispatch: An Expressive and Dynamic Object Model , 2005, ECOOP.

[7]  Randall B. Smith,et al.  SELF: The power of simplicity , 1987, OOPSLA '87.

[8]  Elisa Bertino,et al.  ECOOP 2000 — Object-Oriented Programming , 2000, Lecture Notes in Computer Science.

[9]  Armin B. Cremers,et al.  Lava-Spracherweiterungen für Delegation in Java , 1999, Java-Informations-Tage.

[10]  Jr. Guy L. Steele,et al.  Common LISP: the language (2nd ed.) , 1990 .

[11]  Michael Haupt,et al.  Virtual machine support for dynamic join points , 2004, AOSD '04.

[12]  Suresh Jagannathan,et al.  Environments as first class objects , 1987, POPL '87.

[13]  Patrick Chan The Java Developers Almanac 1999 , 1999 .

[14]  Mira Mezini,et al.  Conquering aspects with Caesar , 2003, AOSD '03.

[15]  Volker Wulf,et al.  Exploration environments: concept and empirical evaluation , 2001, GROUP.

[16]  Oege de Moor,et al.  Measuring the dynamic behaviour of AspectJ programs , 2004, OOPSLA.

[17]  Stephan Herrmann,et al.  Model-view-controller and object teams: a perfect match of paradigms , 2003, AOSD '03.

[18]  Ira R. Forman,et al.  Java reflection in action , 2005 .

[19]  Robert Hirschfeld,et al.  Language constructs for context-oriented programming: an overview of ContextL , 2005, DLS '05.

[20]  Wouter Joosen,et al.  Safe language support for feature composition through feature-based dispatch , 2005 .

[21]  Markus Mohnen Interfaces with default implementations in Java , 2002, PPPJ/IRE.

[22]  M. L. Gassanenko CONTEXT-ORIENTED PROGRAMMING , 1998 .

[23]  Robert Hirschfeld,et al.  Extending Advice Activation in AspectS , 2006 .

[24]  Craig Chambers,et al.  Efficient multiple and predicated dispatching , 1999, OOPSLA '99.

[25]  Boris Magnusson,et al.  ECOOP 2002 — Object-Oriented Programming , 2002, Lecture Notes in Computer Science.

[26]  Andry Rakotonirainy,et al.  Context-oriented programming , 2003, MobiDe '03.

[27]  Oscar Nierstrasz,et al.  Adding Traits to (Statically Typed) Languages , 2005 .

[28]  Gary T. Leavens,et al.  MultiJava: Design rationale, compiler implementation, and applications , 2006, TOPL.

[29]  Pascal Costanza,et al.  A Short Overview of AspectL , 2004 .

[30]  Gregor Kiczales,et al.  Efficient method dispatch in PCL , 1990, LISP and Functional Programming.

[31]  Ira R. Forman,et al.  Java Reflection in Action (In Action series) , 2004 .

[32]  Rainer Unland,et al.  Objects, Components, Architectures, Services, and Applications for a Networked World , 2003, Lecture Notes in Computer Science.

[33]  Matthias Hauswirth,et al.  Vertical profiling: understanding the behavior of object-priented applications , 2004, OOPSLA.

[34]  Wolfgang Weck,et al.  Generic Wrappers , 2000, ECOOP.

[35]  Klaus Ostermann,et al.  Dynamically Composable Collaborations with Delegation Layers , 2002, ECOOP.

[36]  Daniel G. Bobrow,et al.  Common lisp object system specification , 1988, SIGP.

[37]  Robert Hirschfeld,et al.  Language Constructs for Context-oriented Programming , 2005 .

[38]  Ondrej Lhoták,et al.  Optimising aspectJ , 2005, PLDI '05.

[39]  Günter Kniesel Type-Safe Delegation for Run-Time Component Adaptation , 1999, ECOOP.

[40]  David A. Moon,et al.  A monotonic superclass linearization for Dylan , 1996, OOPSLA '96.

[41]  Daniel G. Bobrow,et al.  Representing design alternatives , 1980 .

[42]  Patrick Chan The Java Developers Almanac 1.4 : Examples and quick reference , 2002 .

[43]  Jørgen Lindskov Knudsen ECOOP 2001 — Object-Oriented Programming , 2001, Lecture Notes in Computer Science.

[44]  Guanling Chen,et al.  A Survey of Context-Aware Mobile Computing Research , 2000 .

[45]  William G. Griswold,et al.  An Overview of AspectJ , 2001, ECOOP.

[46]  Andrew P. Black ECOOP 2005 - Object-Oriented Programming, 19th European Conference, Glasgow, UK, July 25-29, 2005, Proceedings , 2005, ECOOP.

[47]  Michael Haupt,et al.  Efficient control flow quantification , 2006, OOPSLA '06.

[48]  Henry Lieberman,et al.  Using prototypical objects to implement shared behavior in object-oriented systems , 1986, OOPLSA '86.

[49]  Cristina V. Lopes,et al.  Workshop on Aspects and Dimensions of Concern: Requirements on, and Challenge Problems for, Advanced Separation of Concerns , 2000, ECOOP Workshops.

[50]  Wouter Joosen,et al.  Dynamic and selective combination of extensions in component-based applications , 2001, Proceedings of the 23rd International Conference on Software Engineering. ICSE 2001.

[51]  Randall B. Smith,et al.  A Simple and Unifying Approach to Subjective Objects , 1996, Theory Pract. Object Syst..

[52]  Gian Pietro Picco,et al.  Understanding code mobility , 1998, Proceedings of the 2000 International Conference on Software Engineering. ICSE 2000 the New Millennium.

[53]  Pascal Costanza How to Make Lisp More Special , 2005 .