当前位置: X-MOL 学术Inf. Softw. Technol. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Context-Oriented Behavioral Programming
Information and Software Technology ( IF 3.9 ) Pub Date : 2020-12-30 , DOI: 10.1016/j.infsof.2020.106504
Achiya Elyasaf

Context:

Modern systems require programmers to develop code that dynamically adapts to different contexts, leading to the evolution of new context-oriented programming languages. These languages introduce new software-engineering challenges, such as: how to maintain the separation of concerns of the codebase? how to model the changing behaviors? how to verify the system behavior? and more.

Objective:

This paper introduces Context-Oriented Behavioral Programming (COBP) — a novel paradigm for developing context-aware systems, centered on natural and incremental specification of context-dependent behaviors. As the name suggests, we combine behavioral-programming (BP) — a scenario-based modeling paradigm — with context idioms that explicitly specify when scenarios are relevant and what information they need. The core idea is to connect the behavioral model with a data model that represents the context, allowing an intuitive connection between the models via update and select queries. Combining behavioral-programming with context-oriented programming brings the best of the two worlds, solving issues that arise when using each of the approaches in separation.

Methods:

We begin with providing abstract semantics for COBP and two implementations for the semantics, laying the foundations for applying reasoning algorithms to context-aware behavioral programs. Next, we exemplify the semantics with formal specifications of systems, including a variant of Conway’s Game of Life. Then, we provide two case studies of real-life context-aware systems (one in robotics and another in IoT) that were developed using this tool. Throughout the examples and case studies, we provide design patterns and a methodology for coping with the above challenges.

Results:

The case studies show that the proposed approach is applicable for developing real-life systems, and presents measurable advantages over the alternatives — behavioral programming alone and context-oriented programming alone.

Conclusion:

We present a paradigm allowing programmers and system engineers to capture complex context-dependent requirements and align their code with such requirements.



中文翻译:

面向上下文的行为编程

内容:

现代系统要求程序员开发能动态适应不同上下文的代码,从而导致新的面向上下文的编程语言的发展。这些语言带来了新的软件工程挑战,例如:如何保持代码库关注点的分离?如何为变化的行为建模?如何验证系统行为?和更多。

目的:

本文介绍了面向上下文的行为编程Context-Oriented Behavioral Programming,COBP)—一种用于开发上下文感知系统的新颖范例,其重点是上下文相关行为的自然和增量规范。顾名思义,我们将行为编程(BP)(一种基于场景的建模范例)与上下文习语相结合,后者明确指定了场景何时相关以及它们需要什么信息。核心思想是将行为模型与表示上下文的数据模型连接起来,从而允许通过更新和选择查询在模型之间进行直观的连接。将行为编程与面向上下文的编程相结合带来了两个方面的优点,解决了将每种方法分开使用时出现的问题。

方法:

我们从为COBP提供抽象语义以及为语义提供两种实现开始,为将推理算法应用于上下文感知行为程序奠定了基础。接下来,我们以系统的形式规范来举例说明语义,包括Conway的《生命游戏》的变体。然后,我们提供了使用此工具开发的两个实际情景感知系统的案例研究(一个是机器人技术,另一个是物联网)。在整个示例和案例研究中,我们提供了应对上述挑战的设计模式和方法。

结果:

案例研究表明,所提出的方法适用于开发现实生活中的系统,并且相对于其他选择(仅行为编程和单独的面向上下文的编程)具有明显的优势。

结论:

我们提供了一种范例,允许程序员和系统工程师捕获复杂的上下文相关需求,并使他们的代码与此类需求保持一致。

更新日期:2021-01-29
down
wechat
bug