Declarative Layer Composition with The JCop Programming Language

Program behavior that relies on contextual information, such as physical location or network accessibility, is common in today's appli- cations, yet its representation at the source code level is not suciently supported by programming languages. With context-oriented program- ming (COP), context-dependent behavior can be explicitly modularized and dynamically activated. The available COP implementations oer lan- guage constructs that allow to describe context-dependent functionality and to specify for which control flows this functionality should be exe- cuted. Since these language constructs require modifications to the source code, the contemporary approaches limit the use of COP to program parts whose source code is accessible to the developer (the user code). The dy- namic control over context-dependent behavior in frameworks cannot be directly addressed by COP as this would imply changes to the source code. Instead, context-dependent behavior is addressed whenever a control flow from the framework code enters the user code. Context composition must be addressed at any of these control flow entry points, which may lead to a redundant specification of this functionality. As a result, dynamic control over layers emerges as a crosscutting concern that obstructs the separation of concerns. In this article, we discuss crosscutting layer composition in framework- based applications in detail. Moreover, we discuss limitations for the ex- pression of semantic relationships of layers that might lead to code du- plication. We present a framework-based application, a simple action ad- venture game that we implemented using a conventional COP language. Along this example, we show how our JCop language supports the decla- ration of layer composition and expression of layer relationships.

[1]  Don S. Batory,et al.  Feature-oriented programming and the AHEAD tool suite , 2004, Proceedings. 26th International Conference on Software Engineering.

[2]  Cristina V. Lopes,et al.  Aspect-oriented programming , 1999, ECOOP Workshops.

[3]  Michael Haupt,et al.  Layered method dispatch with INVOKEDYNAMIC: an implementation study , 2010, COP@ECOOP.

[4]  Kim Mens,et al.  Subjective-C - Bringing Context to Mobile Platform Programming , 2010, SLE.

[5]  Gary T. Leavens,et al.  Ptolemy: A Language with Quantified, Typed Events , 2008, ECOOP.

[6]  Patrick Th. Eugster,et al.  EventJava: An Extension of Java for Event Correlation , 2009, ECOOP.

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

[8]  Mira Mezini,et al.  An Overview of CaesarJ , 2006, LNCS Trans. Aspect Oriented Softw. Dev..

[9]  Thomas Leich,et al.  Aspectual Feature Modules , 2008, IEEE Transactions on Software Engineering.

[10]  Brian Foote,et al.  Designing Reusable Classes , 2001 .

[11]  Hidehiko Masuhara,et al.  Improving the development of context-dependent Java applications with ContextJ , 2009, COP@ECOOP.

[12]  Coen De Roover,et al.  Interruptible context-dependent executions: a fresh look at programming context-aware applications , 2012, Onward! 2012.

[13]  Hidehiko Masuhara,et al.  EventCJ: a context-oriented programming language with declarative event-based context transition , 2011, AOSD '11.

[14]  Yuanyuan Song,et al.  Modular software design with crosscutting interfaces , 2006, IEEE Software.

[15]  Jacques Noyé,et al.  Declarative definition of contexts with polymorphic events , 2009, COP@ECOOP.

[16]  Robert Hirschfeld,et al.  Explicit Language and Infrastructure Support for Context-aware Services , 2008, GI Jahrestagung.

[17]  Alexandre Bergel,et al.  Context-Aware Aspects , 2006, SC@ETAPS.

[18]  Anind K. Dey,et al.  Understanding and Using Context , 2001, Personal and Ubiquitous Computing.

[19]  Robert Hirschfeld,et al.  Context-oriented programming for mobile devices: JCop on Android , 2011, COP@ECOOP.

[20]  Tricia Walker,et al.  Computer science , 1996, English for academic purposes series.

[21]  Stefan Hanenberg,et al.  Evolvable Pattern Implementations Need Generic Aspects , 2004, RAM-SE.

[22]  Gregory D. Abowd,et al.  Towards a Better Understanding of Context and Context-Awareness , 1999, HUC.

[23]  Robert Hirschfeld,et al.  Declarative layer composition in framework-based environments , 2012, COP@ECOOP.

[24]  Oscar Nierstrasz,et al.  Context-oriented programming: beyond layers , 2007, ICDL '07.

[25]  Michael Haupt,et al.  An implementation substrate for languages composing modularized crosscutting concerns , 2009, SAC '09.

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

[27]  Matteo Pradella,et al.  JavaCtx: seamless toolchain integration for context-oriented programming , 2011, COP@ECOOP.

[28]  Hidehiko Masuhara,et al.  Designing event-based context transition in context-oriented programming , 2010, COP@ECOOP.

[29]  Armin B. Cremers,et al.  A context management infrastructure with language integration support , 2011, COP@ECOOP.

[30]  Robert Hirschfeld,et al.  An open implementation for context-oriented layer composition in ContextJS , 2011, Sci. Comput. Program..

[31]  Armin B. Cremers,et al.  Towards Context-Sensitive Service Aspects , 2006 .

[32]  Ole Lehrmann Madsen,et al.  Object-oriented programming in the BETA programming language , 1993 .

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

[34]  Robert Hirschfeld,et al.  Dynamic contract layers , 2010, SAC '10.

[35]  Gregor Kiczales,et al.  Aspect-oriented programming , 2001, ESEC/FSE-9.

[36]  Don S. Batory,et al.  Scaling step-wise refinement , 2004, IEEE Transactions on Software Engineering.

[37]  Kim Mens,et al.  Context-Oriented Programming with the Ambient Object System , 2008, J. Univers. Comput. Sci..

[38]  Michael Haupt,et al.  An Introduction to Context-Oriented Programming with ContextS , 2007, GTTSE.