Giorgio Audrito, Roberto Casadei, Ferruccio Damiani, Mirko Viroli
{"title":"Computation Against a Neighbour: Addressing Large-Scale Distribution and Adaptivity with Functional Programming and Scala","authors":"Giorgio Audrito, Roberto Casadei, Ferruccio Damiani, Mirko Viroli","doi":"10.46298/lmcs-19(1:6)2023","DOIUrl":null,"url":null,"abstract":"Recent works in contexts like the Internet of Things (IoT) and large-scale\nCyber-Physical Systems (CPS) propose the idea of programming distributed\nsystems by focussing on their global behaviour across space and time. In this\nview, a potentially vast and heterogeneous set of devices is considered as an\n\"aggregate\" to be programmed as a whole, while abstracting away the details of\nindividual behaviour and exchange of messages, which are expressed\ndeclaratively. One such a paradigm, known as aggregate programming, builds on\ncomputational models inspired by field-based coordination. Existing models such\nas the field calculus capture interaction with neighbours by a so-called\n\"neighbouring field\" (a map from neighbours to values). This requires ad-hoc\nmechanisms to smoothly compose with standard values, thus complicating\nprogramming and introducing clutter in aggregate programs, libraries and\ndomain-specific languages (DSLs). To address this key issue we introduce the\nnovel notion of \"computation against a neighbour\", whereby the evaluation of\ncertain subexpressions of the aggregate program are affected by recent\ncorresponding evaluations in neighbours. We capture this notion in the\nneighbours calculus (NC), a new field calculus variant which is shown to\nsmoothly support declarative specification of interaction with neighbours, and\ncorrespondingly facilitate the embedding of field computations as internal DSLs\nin common general-purpose programming languages -- as exemplified by a Scala\nimplementation, called ScaFi. This paper formalises NC, thoroughly compares it\nwith respect to the classic field calculus, and shows its expressiveness by\nmeans of a case study in edge computing, developed in ScaFi.","PeriodicalId":314387,"journal":{"name":"Log. Methods Comput. Sci.","volume":"4 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2020-12-15","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"3","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Log. Methods Comput. Sci.","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.46298/lmcs-19(1:6)2023","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 3
Abstract
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.