Giorgio Audrito ; Roberto Casadei ; Ferruccio Damiani ; Mirko Viroli - Computation Against a Neighbour: Addressing Large-Scale Distribution and Adaptivity with Functional Programming and Scala

lmcs:6989 - Logical Methods in Computer Science, January 18, 2023, Volume 19, Issue 1 - https://doi.org/10.46298/lmcs-19(1:6)2023
Computation Against a Neighbour: Addressing Large-Scale Distribution and Adaptivity with Functional Programming and ScalaArticle

Authors: Giorgio Audrito ; Roberto Casadei ; Ferruccio Damiani ; Mirko Viroli

    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.


    Volume: Volume 19, Issue 1
    Published on: January 18, 2023
    Accepted on: October 17, 2022
    Submitted on: December 17, 2020
    Keywords: Computer Science - Distributed, Parallel, and Cluster Computing,Computer Science - Logic in Computer Science,Computer Science - Programming Languages

    Classifications

    Mathematics Subject Classification 20201

    1 Document citing this article

    Consultation statistics

    This page has been seen 2247 times.
    This article's PDF has been downloaded 605 times.