Recent works in contexts like the Internet of Things (IoT) and large-scale Cyber-Physical Systems (CPS) propose the idea of programming distributed systems by focussing on their global behaviour across space and time. In this view, a potentially vast and heterogeneous set of devices is considered as an "aggregate" to be programmed as a whole, while abstracting away the details of individual behaviour and exchange of messages, which are expressed declaratively. One such a paradigm, known as aggregate programming, builds on computational models inspired by field-based coordination. Existing models such as the field calculus capture interaction with neighbours by a so-called "neighbouring field" (a map from neighbours to values). This requires ad-hoc mechanisms to smoothly compose with standard values, thus complicating programming and introducing clutter in aggregate programs, libraries and domain-specific languages (DSLs). To address this key issue we introduce the novel notion of "computation against a neighbour", whereby the evaluation of certain subexpressions of the aggregate program are affected by recent corresponding evaluations in neighbours. We capture this notion in the neighbours calculus (NC), a new field calculus variant which is shown to smoothly support declarative specification of interaction with neighbours, and correspondingly facilitate the embedding of field computations as internal DSLs in common general-purpose programming languages -- as exemplified by a Scala implementation, called ScaFi. This paper formalises NC, thoroughly compares it with respect to the classic field calculus, and shows its expressiveness by means of a case study in edge computing, developed in ScaFi.
翻译:在诸如Tings Internet(IoT)和大型网络-物理系统(CPS)等背景下,最近的一些工作在诸如Tings Internet(IoT)和大型网络-物理系统(CMS)等背景下,提出了编程分布系统的构想,其方法是通过在时空中注重其全球行为。在这种观点中,可能广泛而多样的成套装置被视为一个整体规划的“集合”,同时将个人行为和信息交流的细节抽取出来,这些细节以宣言的形式表达。一个称为“总体编程”的范例,以基于实地协调的计算模型为基础。现有的模型,如实地缩略微缩略图,通过所谓的“邻近时间和时间”字段(从邻居到价值观的地图)与邻居进行编程。这需要自动缩略图机制与标准值进行平稳的拼凑,从而使得编程、图书馆和特定域语言(DSLLs)的混编程。为了解决这个关键问题,我们引入了“对邻居进行计算”的新概念,即对特定总编程的缩略图的评估受到邻居最近相应评价的影响。我们把这个概念与正缩缩缩缩图的缩图与正缩图的缩缩化的缩缩缩缩略图显示,这是通过实地的实地的缩略图的实地的缩略图,通过一个称为的实地的缩略图的实地的缩略图解的缩略图。