A framework for analyzing context-oriented programming languages☆
Introduction
Context-aware systems gain increased attention and are embedded in every domain of our daily socio-technological life, for example, in health care (Bricon-Souf and Newman, 2007), education (Ireri et al., 2018), and ambient intelligent systems (Ramos et al., 2011). The paradigm of Context-Oriented Programming (COP) emerged to ease the implementation of such systems (Hirschfeld et al., 2008). Following this paradigm, various languages were extended to support the notion of context. These languages include JCop for Java (Inoue et al., 2014), ContextPy for Python (Pape et al., 2016), Subjective-C for Objective-C (González et al., 2011), or context-oriented behavioral programming (COBPjs) for behavioral programming (BPjs) (Elyasaf, 2021, Elyasaf et al., 2019a), to mention a few examples. These languages share the overall objective of dynamic adaptation, but present differences in their realization of such adaptations, the terminology used, and the programming interface offered to users. Moreover, the different concepts used in each language, and the lack of a standard evaluation, make the comparison between languages and their features challenging. The goal of this work is to facilitate the evaluation of Context-oriented Programming Languages (COPLs). The idea behind such a goal is motivated by the following considerations:
- •
The extent to which COPLs are analyzed is limited, as analysis attempts are dated from over a decade ago (Appeltauer et al., 2009, Salvaneschi et al., 2012a), and only focus on technical issues (Cardozo and Mens, 2022). Thus, a rigorous analysis of COP languages is required from various viewpoints, in particular examining the aspects that refer to their fitness for developing context-aware systems, from the point of view of system developers. Extending the analysis of COPLs from an exclusive implementation point of view.
- •
The analysis of COPLs focuses on a certain view. For example, Salvaneschi et al. (2012a) mainly focus on layered-based approaches, which indeed are dominating, although other approaches to COP exist, and are left out.
To address these considerations, in this work we propose a framework for analyzing context-oriented programming languages. The framework is composed of a set of criteria to be evaluated, together with a set of guidelines on how to evaluate these. The framework examines the concepts supported by the language, the development process support, and development pragmatics. From the viewpoint of COP developers, such a framework can serve as a standard evaluation for COP languages and to further analyze the existing gaps in the paradigm, and between languages. The results of such analysis can serve users in deciding upon the language (with its supporting tools) that best fits their needs. We validate the usefulness of the proposed framework for analyzing COPLs that originated from different paradigms, using three representatives of COPLs. This evaluation confirms that the framework is not biased toward one particular language or implementation technique. In particular, we applied the framework to (1) ServalCJ (Kamina et al., 2013b, Kamina et al., 2014) — which follows the layer-based paradigm; (2) Subjective-C (González et al., 2011) which follows the object-oriented programming paradigm; and (3) COBPjs — which follows the Context-Oriented Behavioral Programming (COBP) paradigm (Elyasaf, 2021), originating from the domain of scenario-based programming. The evaluation was done separately by the first two authors, who are experts in the selected languages. The paper extends our previous work (Elyasaf and Sturm, 2021) by means of further refining the framework, extending the evaluation to other COPLs, and generalizing the findings, pointing to possible improvements.
The paper is organized as follows. In Section 2, we describe a smart home example we use throughout the paper for demonstration purposes. In Section 3, we introduce the framework. Sections 4 Applying the framework to ServalCJ, 5 Applying the framework to Subjective-C, 6 Applying the framework to COBPjs apply the framework to the three COPL exemplars. In Section 7, we discuss the analysis of the framework and the three COPLs. We conclude in Section 8, referring to the usefulness of the framework, and present perspectives for future work.
Section snippets
The smart home
We use a smart home system as an example to clarify different aspects within the framework. We begin with defining the basic requirements of this system and then evolve the requirements to allow the evaluation of context-oriented programming languages’ maintainability.
The framework
In the following, we present a framework to analyze COPLs. The framework emerges from COPLs and context-aware systems studies (Appeltauer et al., 2009, Salvaneschi et al., 2012a, Cardozo and Mens, 2022), general programming languages and software engineering evaluation frameworks (Sturm and Shehory, 2003), and from our own experience in this domain. Different from the mainstream COPL research, in this framework, we aim at abstracting the main concepts and concerns of the paradigm, rather than
Applying the framework to ServalCJ
To start the analysis of COPLs using our framework, we apply it to the ServalCJ (Kamina et al., 2013b, Kamina et al., 2014) language, formerly known as EventCJ (Kamina et al., 2011). ServalCJ is selected as a representative of layer-based COPLs, one of the main implementation techniques followed by COPLs. The reason for choosing this language for our analysis is two-fold. On the one hand, the inception of COP languages arose with a proposal based on layer-based context orientation (Costanza and
Applying the framework to Subjective-C
To further test our proposed framework, we next apply it to Subjective-C. Subjective-C serves as a representative for context-based COPLs, a second family of COPLs in the existing literature, characterized by behavioral variations and explicit activation. Subjective-C2 (González et al., 2011) is a full context-oriented language extension of Objective-C, introducing the notion of contexts, behavioral variations, a context manager, a context
Applying the framework to COBPjs
As an alternative paradigm for COPLs, we continue to evaluate the framework using COBPjs, a language that implements a model-driven engineering paradigm called Context-Oriented Behavioral Programming (COBP).
COBP is a novel language-independent paradigm for developing context-aware systems, centered on the natural and incremental specification of context-dependent behavior (Elyasaf, 2021). The paradigm aims at creating executable specifications from context-dependent requirements. When creating
Discussion
Applying the framework to COPLs originating from different paradigms (i.e., Layered-based, Object-Oriented, Scenario-based) indicates its usefulness, and its ability to abstract important concepts and criteria for COPLs and their usage. Table 2 summarizes the analysis of the COPL representatives using the proposed framework. We observe that all languages similarly address most of the criteria. The differences emerge from the focus of the languages. ServalCJ and Subjective-C emphasize the
Conclusion
Context-Oriented Programming is a programming language-level technique to realize dynamic adaptation of software systems with respect to their surrounding execution environment. Many different languages for COP have been proposed over the last 15 years. Such languages share the overall objective of dynamic adaptation, but present differences in their realization of such adaptations, the terminology used, and the programming interface offered to users. Moreover, the different concepts used in
CRediT authorship contribution statement
Achiya Elyasaf: Conceptualization, Validation, Writing. Nicolás Cardozo: Conceptualization, Validation, Writing. Arnon Sturm: Conceptualization, Methodology, Writing.
Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
Achiya Elyasaf is in the Software and Information Systems Engineering Department at Ben-Gurion University, Israel. Dr. Elyasaf developed the Context-Oriented Behavioral Programming paradigm. He also developed an approach for utilizing expert knowledge for evolving solvers to combinatorial games. This work was recognized as one of the most important achievements of AI in games, placed next to famous achievements, such as the win of Deep Blue over Kasparov and the win of Watson in Jeopardy! (N.
References (56)
- et al.
Context awareness in health care: A review
Int. J. Med. Inform.
(2007) - et al.
Semantics for consistent activation in context-oriented systems
Inf. Softw. Technol.
(2015) - et al.
Programming language implementations for context-oriented self-adaptive systems
Inf. Softw. Technol.
(2022) Context-oriented behavioral programming
Inf. Softw. Technol.
(2021)- et al.
Method safety mechanism for asynchronous layer deactivation
Sci. Comput. Program.
(2018) - et al.
Context-oriented programming: A software engineering perspective
J. Syst. Softw.
(2012) - et al.
Scenario-based programming, usability-oriented perception
Trans. Comput. Educ.
(2014) - et al.
Abc the AspectBench compiler for AspectJ: A workbench for aspect-oriented programming language and compilers research
- et al.
Featherwight eventcj: A core calculus for a context-oriented language with event-based per-instance layer transition
- et al.
Unifying multiple layer activation mechanisms using one event sequence
A comparison of context-oriented programming languages
Structured behavioral programming idioms
Extending Behavioral Programming for Model-Driven Engineering
A Scenario Based On-Board Software and Testing Environment for Satellites
Identification and Management of Inconsistencies in Dynamicaly Adaptive Software Systems
Emergent software services
Auto-COP: Adaptation generation in context-oriented programming using reinforcement learning options
Safer context (de)activation: Through the prompt-loyal strategy
Uniting global and local context behavior with context Petri nets
Feature-oriented programming and context-oriented programming: Comparing paradigm characteristics by example implementations
Context Petri nets: Enabling consistent composition of context-dependent behavior
Feature descriptions for context-oriented programming
LSCs: Breathing Life into Message Sequence Charts
Form. Methods Syst. Des.
Understanding and using context
Pers. Ubiquitous Comput.
Feature Visualiser: An Inspection Tool for Context-Oriented Programmers
Combinatorial sequence testing using behavioral programming and generalized coverage criteria
Towards Integration of Context-Based and Scenario-Based Development, Vol. 10748 LNCS
Cited by (0)
Achiya Elyasaf is in the Software and Information Systems Engineering Department at Ben-Gurion University, Israel. Dr. Elyasaf developed the Context-Oriented Behavioral Programming paradigm. He also developed an approach for utilizing expert knowledge for evolving solvers to combinatorial games. This work was recognized as one of the most important achievements of AI in games, placed next to famous achievements, such as the win of Deep Blue over Kasparov and the win of Watson in Jeopardy! (N. Bostrom, 2014. “ Superintelligence: Paths, Dangers, Strategies ”). In 2021, he co-founded Provengo technologies which provides software-quality solutions based on his expertise in software engineering (SE) and artificial intelligence (AI). In his current research, Dr. Elyasaf seeks new synergies between SE and AI to improve their interoperability and contribute to both.
Nicolás Cardozo is an associate professor at Universidad de los Andes (Colombia). His research interests include the design and implementation of programming languages for distributed adaptive software systems. Nicolás has worked in implementing dynamic distributed adaptations in the smart cities domain from different perspectives, such as automated personalized assistants and evolutionary models for dynamic adaptations. Currently, he is working on the analysis and verification aspects of adaptive systems at the programming language level.
Arnon Sturm is in the Software and Information Systems Engineering department at the Ben-Gurion University of the Negev, Israel. His research interests focus on languages for various purposes, including software development ranging from end-user programming, and database applications, to complex multi-agent systems and knowledge representation and management. He is interested in developing tools to ease the work of developers throughout the development life cycle.
- ☆
Editor: Earl Barr.