Interfaces for Modular Reasoning in Context-Oriented Programming

Different activation mechanisms for Context-Oriented Programming (COP) like implicit activations have been proposed, increasing COP opportunities to be applied in real scenarios. However, activation mechanisms and base code definitions are insufficiently decoupled, as conditionals to activate layers require base code variable references. This hinders reuse, evolution, and modular reasoning of COP and base code, and therefore, uses of COP in real scenarios. This paper proposes interfaces, which are shared abstractions to communicate activation mechanisms and base code in a decoupled manner. Using these interfaces, an object can exhibit its internal state and behaviors, and conditionals use them to (de)activate layers. As layers are planned to be (re)used in different applications, developers can use interfaces to overcome the incompatibility between values exposed by a particular base code and values required by a layer. In addition, as a layer is a plain object, it can use an interface to exhibit the conditional evaluation of its activation to other layers to resolve conflicts among activations of layers. We apply this proposal to implicit activations in which evaluations of conditionals implicitly (de)activate layers. Finally, we illustrate the benefits of this proposal through RI-JS, a practical JavaScript library that currently supports interfaces, reactive activations (implementation variant for implicit activations), global and dynamic deployment, enter and exit transition processes, and partial methods.

[1]  Kim Mens,et al.  Predicated generic functions: enabling context-dependent method dispatch , 2010 .

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

[3]  Tetsuo Kamina,et al.  TinyCORP: A Calculus for Context-Oriented Reactive Programming , 2019, COP '19.

[4]  P. Leger,et al.  ECOCAM, un sistema computacional adaptable al contexto para promover estrategias de cálculo mental: características de su diseño y resultados preliminares , 2014 .

[5]  Standard Glossary of Software Engineering Terminology , 1990 .

[6]  Tetsuo Kamina,et al.  Harmonizing Signals and Events with a Lightweight Extension to Java , 2018, Art Sci. Eng. Program..

[7]  Robert Hirschfeld,et al.  Compatibility layers for interface mediation at run-time , 2016, MODULARITY.

[8]  Takuo Watanabe A Simple Context-Oriented Programming Extension to an FRP Language for Small-Scale Embedded Systems , 2018, COP@ECOOP.

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

[10]  Shriram Krishnamurthi,et al.  Flapjax: a programming language for Ajax applications , 2009, OOPSLA '09.

[11]  Edward Amsden,et al.  A Survey of Functional Reactive Programming Concepts , Implementations , Optimizations , and Applications , 2011 .

[12]  Éric Tanter Expressive scoping of dynamically-deployed aspects , 2008, AOSD.

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

[14]  Jürgen Graf,et al.  Using pointcut delta analysis to support evolution of aspect-oriented software , 2005, 21st IEEE International Conference on Software Maintenance (ICSM'05).

[15]  Kris Gybels,et al.  Arranging language features for more robust pattern-based crosscuts , 2003, AOSD '03.

[16]  Eric Bodden,et al.  Join point interfaces for safe and flexible decoupling of aspects , 2014, TSEM.

[17]  Éric Tanter,et al.  AspectScript: expressive aspects for the web , 2010, AOSD.

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

[19]  Jonathan Aldrich,et al.  Open Modules: Modular Reasoning About Advice , 2005, ECOOP.

[20]  Sven Apel,et al.  Types and modularity for implicit invocation with implicit announcement , 2010, TSEM.

[21]  Hidehiko Masuhara,et al.  Push-based reactive layer activation in context-oriented programming , 2017, COPS '17.

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

[23]  Robert Hirschfeld,et al.  The declarative nature of implicit layer activation , 2017, COPS '17.

[24]  Michael Haupt,et al.  Event-Specific Software Composition in Context-Oriented Programming , 2010, SC@TOOLS.

[25]  Éric Tanter,et al.  Beyond static and dynamic scope , 2009, DLS '09.

[26]  Hidehiko Masuhara,et al.  Generalized Layer Activation Mechanism for Context-Oriented Programming , 2016, LNCS Trans. Modul. Compos..

[27]  Paul Hudak,et al.  Functional reactive animation , 1997, ICFP '97.

[28]  AugustoJuan Carlos,et al.  Engineering context-aware systems and applications , 2016 .

[29]  Juan Carlos Augusto,et al.  Engineering context-aware systems and applications: A survey , 2016, J. Syst. Softw..

[30]  Harold Ossher,et al.  Korz: Simple, Symmetric, Subjective, Context-Oriented Programming , 2014, Onward!.

[31]  Michael Haupt,et al.  ContextJ: Context-oriented Programming with Java , 2011 .

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

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

[34]  Mahadev Satyanarayanan,et al.  Pervasive computing: vision and challenges , 2001, IEEE Wirel. Commun..

[35]  Matteo Pradella,et al.  Context-oriented programming: A software engineering perspective , 2012, J. Syst. Softw..

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

[37]  Robert Hirschfeld,et al.  Group-Based Behavior Adaptation Mechanisms in Object-Oriented Systems , 2017, IEEE Software.

[38]  Hidehiko Masuhara,et al.  Unifying Multiple Layer Activation Mechanisms Using One Event Sequence , 2014, COP'14.

[39]  Gregory H. Cooper,et al.  Integrating Dataflow Evaluation into a Practical Higher-Order Call-by-Value Language , 2008 .

[40]  Jesse Liberty,et al.  Reactive Extensions for JavaScript , 2011 .

[41]  Jean-Yves Fourniols,et al.  Smart wearable systems: Current status and future challenges , 2012, Artif. Intell. Medicine.

[42]  Gregor Kiczales,et al.  Aspect-oriented programming , 1996, CSUR.

[43]  Rémi Douence,et al.  Expressive scoping of distributed aspects , 2009, AOSD '09.