Context-oriented programming

R Hirschfeld, P Costanza, O Nierstrasz - Journal of Object technology, 2008 - boris.unibe.ch
Journal of Object technology, 2008boris.unibe.ch
Context-dependent behavior is becoming increasingly important for a wide range of
application domains, from pervasive computing to common business applications.
Unfortunately, mainstream programming languages do not provide mechanisms that enable
software entities to adapt their behavior dynamically to the current execution context. This
leads developers to adopt convoluted designs to achieve the necessary runtime flexibility.
We propose a new programming technique called Context-oriented Programming (COP) …
Context-dependent behavior is becoming increasingly important for a wide range of application domains, from pervasive computing to common business applications. Unfortunately, mainstream programming languages do not provide mechanisms that enable software entities to adapt their behavior dynamically to the current execution context. This leads developers to adopt convoluted designs to achieve the necessary runtime flexibility. We propose a new programming technique called Context-oriented Programming (COP) which addresses this problem. COP treats context explicitly, and provides mechanisms to dynamically adapt behavior in reaction to changes in context, even after system deployment at runtime. In this paper we lay the foundations of COP, show how dynamic layer activation enables multi-dimensional dispatch, illustrate the application of COP by examples in several language extensions, and demonstrate that COP is largely independent of other commitments to programming style.
boris.unibe.ch