Mirko Viroli
email: mirko.viroli@unibo.it

Jacob Beal
email: jakebeal@ieee.org

Ferruccio Damiani
email: damiani@di.unito.it

Giorgio Audrito
email: audrito@di.unito.it

Roberto Casadei
email: roby.casadei@unibo.it

Danilo Pianini
email: danilo.pianini@unibo.it

* Capabili'es

Founda'onal

Api

Domain>specific

Apis

From Field-Based Coordination to Aggregate Computing

Keywords: Distributed Systems Coordination Languages Field Models Spatial Computing Library Elaboration, Middleware Platforms Feedback & Dynamics, Device/Process Mobility Security 2 Coordination, Self-Organisation, and Fields

Aggregate computing is an emerging approach to the engineering of complex coordination for distributed systems, based on viewing system interactions in terms of information propagating through collectives of devices, rather than in terms of individual devices and their interaction with their peers and environment. The foundation of this approach is the distillation of a number of prior approaches, both formal and pragmatic, proposed under the umbrella of field-based coordination, and culminating into the field calculus, a functional programming model for the specification and composition of collective behaviours with equivalent local and aggregate semantics. This foundation has been elaborated into a layered approach to engineering coordination of complex distributed systems, building up to pragmatic applications through intermediate layers encompassing reusable libraries of provably resilient program components. In this survey, we trace the development and antecedents of field calculus, review the current state of aggregate computing theory and practice, and discuss a roadmap of current research directions that we believe can significantly impact the agenda of coordination models and languages.

This work has been partially

Introduction

As computing devices continue to become cheaper and more pervasive, the complexity of the distributed systems that run our world continues to increase. Over the past several decades, we have moved from many people sharing a single computer to a computer for each person to many, mostly embedded and minimalinterface computing devices for each person. The only way to effectively engineer Fig. 1. This survey reviews the development of field calculus from its antecedents (left), the current state of aggregate computing theory and practice as layered abstractions based on field calculus (middle), and current research directions on top of field calculus with respect to challenges in coordination models and languages (right).

and coordinate the operation of such systems is to program and operate in terms of aggregates of devices rather than attempting to micro-manage each individual device. Moreover, as devices become more numerous, smaller, and more embedded, decentralisation brings new opportunities as well as new challenges-not only in terms of pervasive sensing/actuation/computation abilities, but also of increasing advantages in resilience, efficiency, and privacy.

Aggregate computing is an emerging approach, developed significantly within the coordination models and languages research community, that embraces this environment, building from a foundation on the field calculus, a functional programming model for the specification and composition of collective behaviours with formally equivalent local and aggregate semantics. Atop this foundation, a layered approach to engineering coordination of complex distributed systems has been constructed, first considering challenges of resilience, then pragmatism in the form of reusable libraries capturing common coordination patterns, and finally applications across a number of different domains. As the research on aggregate computing is becoming rather multi-faceted, we also envision a variety of research directions of high importance for distributed systems and specifically for coordination models and languages, both in theory, engineering methods and tools, and applications.

In this survey, we present a discussion of the past, present, and future of aggregate computing (Figure 1). Section 2 begins by tracing the development of aggregate computing through its antecedents both in coordination research and in other areas, culminating in development of the field calculus. Section 3 then discusses the current state of aggregate computing theory and practice across its various abstraction layers. Finally, Section 4 presents a roadmap of current research directions on top of field calculus and with respect to challenges in coordination models and languages, and Section 5 summarises and concludes.

Programmable coordination rules

The vision of tuple-based coordination as a shared knowledge repository used for agent coordination is further promoted by logic tuple-space models, where software agents coordinate through firstorder tuples, and tuple spaces can be programmed as first-order logic theories. A prominent example of such approach is Shared Prolog [START_REF] Brogi | The concurrent language, Shared Prolog[END_REF], a framework for writing multi-processor Prolog systems. More generally, this view promotes the idea of equipping the shared space with some form of "intelligence", i.e., in the form of an application logic that can manipulate data in the shared space and the way it can be accessed. Several Linda-inspired approaches tackle this issue by enabling programmability at the tuple-space level in order to express rules of coordination, and hence, pushing forward a notion of expressiveness of the coordination media [START_REF] Busi | Coordination models: A guided tour[END_REF]. Among them, we find Law-Governed Interaction [START_REF] Minsky | Law-Governed interaction: A coordination and control mechanism for heterogeneous distributed systems[END_REF], MARS [START_REF] Cabri | MARS: A programmable coordination architecture for mobile agents[END_REF] and ReSpecT [START_REF] Omicini | From tuple spaces to tuple centres[END_REF].

Distribution All these approaches, however, do not explicitly focus on distributed systems, but on the coordination of centralised local components. As software components get spread across the system topology, so multiple tuple spaces can be distributed across the system environment, enabling distributed coordination abstractions, featuring mechanisms for event-based interactions, timing, and advanced data representation. This is the case with industrial systems like JavaSpaces [START_REF] Freeman | JavaSpaces Principles, Patterns, and Practice: Principles, Patterns and Practices. The Jini Technology Series[END_REF] and TSpaces [START_REF] Wyckoff | T Spaces[END_REF]. Lime [START_REF] Murphy | Lime: A coordination model and middleware supporting mobility of hosts and agents[END_REF], Klaim [START_REF] De Nicola | KLAIM: A kernel language for agent interaction and mobility[END_REF], and LogOp [START_REF] Menezes | Coordination of distributed components using LogOp[END_REF], take the approach a step further, by allowing to express the dynamic environment topology in a distributed setting, thus paving the way towards application of coordination models to pervasive computing system scenarios.

Self-organising coordination As coordination abstractions of various sorts (tuple spaces, channels, coordination artifacts [START_REF] Viroli | Engineering MAS environment with artifacts[END_REF][START_REF] Omicini | Coordination artifacts: Environment-based coordination for intelligent agents[END_REF]) are available in the distributed settings, one is directly faced with the problem of dealing with openness (hence, unexpectedness of environment changes, faults, and interactions), largescale (possibly a huge number of agents and coordination abstractions to be managed), and intrinsic adaptiveness (as the ability of intercepting relevant events, and react to them so as to guarantee certain levels of overall system resilience). This calls for an approach of self-organising coordination [START_REF] Viroli | A framework for modelling and implementing self-organising coordination[END_REF], where coordination abstractions handle "local" interactions only (and typically use stochastic mechanisms to keep the coordination process always "up and running"), such that global and robust patterns of correct coordination behaviour can emergeachieved by trading off by-design adaptiveness with inherent, automatic one.

Coordination models following this approach typically take their inspiration from complex natural systems (from physics through chemistry all the way to ethology) and reuse their foundational mechanisms. A primary source of inspiration for these systems is to be found in biology (social animals, and insects in particular), whose foraging techniques inspire the mechanisms that regulate coordination [START_REF] Casadei | On the collective sort problem for distributed tuple spaces[END_REF][START_REF] Tolksdorf | Using swarm intelligence in Linda systems[END_REF][START_REF] Pianini | Self organization in coordination systems using a WordNet-based ontology[END_REF]. For instance, SwarmLinda [START_REF] Tolksdorf | Using swarm intelligence in Linda systems[END_REF] is a tuple-based middleware that brings the collective intelligence displayed by swarms of ants to computational mechanisms to guarantee efficient retrieval. Tuples are handled as sort of pheromones or items that ants (agents) continuously and opportunistically relocate. Chemical-inspiration is used in [START_REF] Viroli | Biochemical tuple spaces for self-organising coordination[END_REF][START_REF] Viroli | Spatial coordination of pervasive services through chemical-inspired tuple spaces[END_REF] to regulate the "activity level" of tuples, which drives the likelihood of their retrieval as well as their propagation rate. Ecology-inspiration is instead used in [START_REF] Viroli | On competitive self-composition in pervasive services[END_REF] to inject competition, composition, and disposal behaviour in the context of coordination of pervasive computing services.

Field-based coordination

Another important natural source of inspiration comes from physics: physicsinspired self-organising coordination systems rely on the notion of "field" (grav-itational field, electromagnetic field), which essentially provides a framework to handle (create, manipulate, combine) global-level, distributed data structures.

A notion of coordination field (or co-field) was initially proposed in [START_REF] Mamei | Co-fields: Towards a unifying approach to the engineering of swarm intelligent systems[END_REF] as a means to support self-organisation patterns of agent movement in complex environments: it was used as an abstraction over the actual environment, spread by both agents and the environment itself, and used by agents (which can locally perceive the value of fields) to properly navigate the environment. Based on this idea, the TOTA (Tuples On The Air) tuple-based middleware [START_REF] Mamei | Programming pervasive and mobile computing applications: The TOTA approach[END_REF] was proposed to support field-based coordination for pervasive-computing applications. In TOTA each tuple, when inserted into a node of the network, is equipped with a content (the tuple data), a diffusion rule (the policy by which the tuple has to be cloned and diffused around) and a maintenance rule (the policy whereby the tuple should evolve due to events or time elapsing).

The evolving tuples model, presented in [START_REF] Stovall | Resource discovery with evolving tuples[END_REF], is an extension to traditional Linda tuple spaces with the goal of supporting resource discovery in a pervasive system, relying on ideas inspired by TOTA. Evolution is firstly embedded in tuples by adding, to each field of the tuple, a name and a formula that specifies the field behaviour over time. Formulas support the if-then-else construct and arithmetic and boolean operators. Secondly, a new operation evolve() is introduced in the tuple space, which is responsible for applying formulas to tuples using contextual information.

One of the first works connecting field-based coordination with formalisation tools typical of coordination models and languages (i.e., process algebras and transition systems) is the στ -Linda model [START_REF] Viroli | Linda in space-time: An adaptive coordination model for mobile ad-hoc environments[END_REF], where agents can inject into the space "processes" that spread, collect and decay tuples, ultimately sustaining fields of tuples.

Spatial computing approaches: towards the field calculus

More or less independently from the problem of finding suitable coordination models for distributed and situated systems, a number of works addressed similar problems in the more general attempt of building distributed intelligent systems by promoting higher abstractions of spatial collective adaptive systems. Works such as [START_REF] Beal | Organizing the aggregate: Languages for spatial computing[END_REF][START_REF] Dobson | A survey of autonomic communications[END_REF][START_REF] Menezes | Adaptiveness in Linda-based coordination models[END_REF][START_REF] Omicini | Coordination models and languages: From parallel computing to self-organisation[END_REF] survey from various different viewpoints the many approaches that fall under this umbrella (including also some of the above mentioned coordination models), and which mainly organise in the following categories: methods that simplify programming of a collective by abstracting individual networked devices (e.g., SCEL [START_REF] De Nicola | A formal approach to autonomic systems programming: The SCEL language[END_REF], Hood [START_REF] Whitehouse | Hood: a neighborhood abstraction for sensor networks[END_REF], Butera's "paintable computing" [START_REF] Butera | Programming a Paintable Computer[END_REF], and Meld [START_REF] Ashley-Rollman | Meld: A declarative approach to programming ensembles[END_REF]), spatial patterns and languages (e.g., Growing Point Language [START_REF] Coore | Botanical Computing: A Developmental Approach to Generating Inter connect Topologies on an Amorphous Computer[END_REF], geometric patterns in Origami Shape Language [START_REF] Nagpal | Programmable Self-Assembly: Constructing Global Shape using Biologically-inspired Local Interactions and Origami Mathematics[END_REF], self-healing geometries [START_REF] Clement | Self-assembly and self-repairing topologies[END_REF], or universal patterns [START_REF] Yamins | A Theory of Local-to-Global Algorithms for One-Dimensional Spatial Multi-Agent Systems[END_REF]), tools to summarise and stream information over regions of space and time (e.g., TinyDB [START_REF] Madden | TAG: A Tiny AGgregation service for ad-hoc sensor networks[END_REF], Cougar [START_REF] Yao | The Cougar approach to in-network query processing in sensor networks[END_REF], TinyLime [START_REF] Curino | Mobile data collection in sensor networks: The TinyLime middleware[END_REF], and Regiment [START_REF] Newton | Region streams: Functional macroprogramming for sensor networks[END_REF]), and finally space-time computing models aiming at the manipulation of data structures diffused in space and evolving with time, e.g. targeting parallel computing (e.g., StarLisp [START_REF] Lasser | Starlisp Reference Manual[END_REF], systolic computing [START_REF] Engstrom | The SDEF programming system[END_REF]) and topological computing (e.g., MGS [START_REF] Giavitto | Computational models for integrative and developmental biology[END_REF][START_REF] Giavitto | Computations in space and space in computations[END_REF]). Among them, space-time computing models based on the notion of computational fields were initially proposed in [START_REF] Beal | Infrastructure for engineered emergence in sensor/actuator networks[END_REF] and implemented in the Proto language. Combining techniques coming from the above approaches and generalising over Proto (which can be considered the archetypal spatial computing language due to its expressiveness and versatility), the field calculus has been proposed as a foundational model for the coordination of computational devices spread in physical environments.

From Field Calculus to Aggregate Computing

In this section, we discuss the current state of the art in aggregate computing, with the goal of presenting the full spectrum of results achieved without going into deep technical details-the reader can access code examples and tutorials, as well as formalisation of semantics, from the references provided. We begin with a review of its mathematical core in field calculus (Section 3.1), then discuss the construction of implementations of field calculus as the domain specific language Protelis (Section 3.2) and Scala support ScaFi (Section 3.3). Finally, we discuss the layered abstractions of aggregate programming built upon these foundations, from resilient operators to pragmatic libraries (Section 3.4).

Field Calculus

Basic calculus The field calculus (FC) has been proposed in [START_REF] Viroli | A calculus of computational fields[END_REF] as a minimal core calculus meant to capture the key ingredients of languages that make use of computational fields:4 functional composition of fields, functions over fields, evolution of fields over time, construction of fields of values from neighbours, and restriction of a field computation to a sub-region of the network.

The field calculus is based on the idea of specifying aggregate system behaviour of a network of devices (where a dynamic neighbouring relation represents physical or logical proximity) by a functional composition of operators that manipulate (evolve, combine, restrict) computational fields. A key feature of the approach is that a specification can be interpreted locally or globally. Locally, it can be seen as describing a computation on an individual device, iteratively executed in asynchronous "computation rounds" comprising: reception of messages from neighbours, perception of contextual information through sensors, storing local state of computation, computing the local value of fields and spreading messages to neighbours. Globally, a field calculus expression e specifies a mapping (i.e., the computational field) associating each computation round of each device to the value that e assumes on that space-time event. This duality intrinsically supports the reconciliation between the local behaviour of each device and the emerging global behaviour of the whole network of devices [START_REF] Damiani | A type-sound calculus of computational fields[END_REF][START_REF] Viroli | A calculus of computational fields[END_REF].

The distinguished interaction model of this approach has been first formalised in [START_REF] Viroli | A calculus of computational fields[END_REF] by means of a small-step operational semantics modelling single device The main technical novelty in this formalisation is that device state and message content are represented in an unified way as an annotated evaluation tree. Field construction, propagation, and restriction are then supported by local evaluation "against" the evaluation trees received from neighbours. Accessing these values is allowed by two specialised constructs:

rep(e 0 ){(x)=>e} which retrieves the value v computed for the whole rep expression in the last evaluation round (the value produced by evaluating the expression e 0 is used at the first evaluation round) and updates it by the value produced by evaluating the expression obtained from e by replacing the occurrences of x by v; -nbr{e}, which gathers the values computed by neighbours for expression e (from the respective evaluation trees) in their last round of computation into a neighbouring field value, which is a map from neighbour device identifiers to their correspondent values.

These constructs are backened by a data gathering mechanism accomplished through a process called alignment, which ensures appropriate message matching, i.e., that no two different nbr expressions can inadvertently "swap" their respective messages. This has the notable consequence that the two branches of an if statement in field calculus are executed in isolation: devices computing the "then" branch cannot communicate with a device computing the "else" branch, and viceversa.

Consider as an example Figure 2. Function distanceTo takes as argument a field of booleans source, associating true to source nodes, and produces as result a field of reals, mapping each device to its minimum distance to a source node, computing relaxation of triangle inequality; namely: repetitively, and starting from infinity (construct rep) everywhere, the distance on any node gets updated to 0 on source nodes (function mux(c,t,e) is a purely functional multiplexer which chooses t if c is true, or e otherwise), and elsewhere to the minimum (built-in minHood) of neighbours' distance (construct nbr) added with nbrRange, a sensor for estimated distances. Function distanceToWithObs takes an additional argument, a field of booleans obstacle, associating true to obstacle nodes; it partitions the space of devices: on obstacle nodes it gives the field of infinity values, elsewhere it reuses computation of distanceTo. Because of alignment, the set of considered neighbours for distanceTo automatically discards nodes that evaluate the other branch of if, effectively making computation of distances circumvent obstacles. Finally, the main expression calls distanceToWithObs to compute distances from the node with id equal to 0, circumventing the devices where senseObs gives true.

The work in [START_REF] Damiani | A type-sound calculus of computational fields[END_REF] (which is an extended and revised version of [START_REF] Viroli | A calculus of computational fields[END_REF]) presents a type system, used to intercept ill-formed field-calculus programs. The type system, which builds on the HindleyMilner type system [START_REF] Damas | Principal type-schemes for functional programs[END_REF] for ML-like functional languages, is specified by a set of syntax-directed type inference rules. Being syntax-directed, the rules straightforwardly specify a variant of the Hindley-Milner type inference algorithm [START_REF] Damas | Principal type-schemes for functional programs[END_REF]. Namely, an algorithm that given a field calculus expression and type assumptions for its free variables: either fails (if the expression cannon be typed under the given type assumptions) or returns its principal type, i.e., a type such that all the types that can be assigned to an expression by the type inference rules can be obtained from the principal type by substituting type variables with types.

Types are partitioned in two sets: types for expressions and types for functions (built-in operators and user-defined functions)-this reflects the fact that the field calculus does not support higher order functions (i.e., functions are not values). Expression types are further partitioned in two sets: types for local values (e.g., the values produced by numerical literals) and types for neighbouring field values (e.g., the values produced by nbr-expressions).

The type system is proved to guarantee the following two properties:

-Domain alignment: On each device, the domain of every neighbouring field value arising during the reduction of a well-typed expression consists of the identifiers of the aligned neighbours and of the identifier of the device itself.

In other words, information sharing is scoped to precisely implement the aggregate abstraction. -Type soundness: The reduction of a well-typed expression terminates.

Higher-order field calculus The higher-order field calculus (HFC) [START_REF] Damiani | Code mobility meets self-organisation: A higher-order calculus of computational fields[END_REF] (see also [START_REF] Viroli | A higher-order calculus of computational fields[END_REF]) is an extension of the field calculus with first-class functions. Its primary goal is to allow programmers to handle functions just like any other value, so that code can be dynamically injected, moved, and executed in network (sub)domains. Namely, in HFC:

-Functions can take functions as arguments and return a function as result (higher-order functions). This is key to define highly reusable building block functions, which can then be fully parameterised with various functional strategies.

-Functions can be created "on the fly" (anonymous functions). Among other applications, such functions can be passed into a system from the external environment, as a field of functions considered as input coming from a sensor modelling addition of new code into a device while the system is operating. -Functions can be moved between devices (via the nbr construct) and the function to be executed can change over time (via rep construct), which allows one to express complex patterns of code deployment across space and time. -A field of functions (possibly created on the fly and then shared by movement to all devices) can be used as an aggregate function operating over a whole spatial domain.

In considering fields of function values, HFC takes the approach in which making a function call acts as a branch, with each function in the range of the field applied only on the subspace of devices that hold that function. When the field of functions is constant, this implicit branch reduces to be precisely equivalent to a standard function call. This means that we can view ordinary evaluation of a function name (or anonymous function) as equivalent to creating a functionvalued field with a constant value, then making a function call applying that field to its argument fields. This elegant transformation is one of the key insight of HFC, enabling first-class functions to be implemented with relatively minimal complexity.

In [START_REF] Damiani | Code mobility meets self-organisation: A higher-order calculus of computational fields[END_REF] the operational semantics of HFC is formalised, for computation within a single device, by a big-step operational semantics where each expression evaluates to an ordered tree of values tracking the results of all evaluated subexpressions. Moreover, [START_REF] Damiani | Code mobility meets self-organisation: A higher-order calculus of computational fields[END_REF] also presents a formalisation of network evolution, by a transition system on network configurations-transitions can either be firings of a device or network configuration changes, while network configurations model environmental conditions (i.e., network topology and inputs of sensors on each device) and the overall status of devices in the network at a given time.

Behavioural properties Since HFC is designed as a general-purpose language for spatially distributed computations, its semantics and type system guarantees do not prevent the formulation of ill-behaving programs. Thus, regularity properties have been isolated and studied for subsets of the core language. Among them, the established notion of self-stabilisation to correct states for distributed systems [START_REF] Dolev | Self-Stabilization[END_REF][START_REF] Lluch-Lafuente | Asynchronous distributed execution of fixpoint-based computational fields[END_REF][START_REF] Lluch-Lafuente | A fixpoint-based calculus for graphshaped computational fields[END_REF] plays a central role. This notion, defined in terms of properties of the transition system of network evolution, ensures that both (i) the evaluation of a program on an eventually constant input converges to a limit value in each device in finite time; (ii) this limit only depends on the input values, and not on the transitory input values that may have happened before that. When applied in a dynamically evolving system, a self-stabilising algorithm guarantees that whenever the input changes, the output reacts accordingly without spurious influences from past values.

In [START_REF] Damiani | Type-based self-stabilisation for computational fields[END_REF] (which is an extended version of [START_REF] Viroli | A calculus of self-stabilising computational fields[END_REF]), a first self-stabilising fragment is isolated through a spreading operator, which minimises neighbour val-ues as they are monotonically updated by a diffusion function. This pattern can be composed arbitrarily with local operations, but no explicit rep and nbr expressions are allowed: nonetheless, several building blocks can be expressed inside this fragment, such as classic distance estimation. However, more selfstabilising programs and existing "building block" implementations are covered by the larger self-stabilising fragment introduced in [START_REF] Viroli | Engineering resilient collective adaptive systems by self-stabilisation[END_REF] (which is an extended version of [START_REF] Viroli | Efficient engineering of complex selforganising systems by self-stabilising fields[END_REF]). This fragment restricts the usage of rep statements to three specific patterns (converging, acyclic and minimising rep), roughly corresponding to the three main building blocks (time evolution, aggregation, distance estimation). Furthermore, a notion of equivalence and substitutability for self-stabilising programs is examined: on the one hand, this notion allows for practical optimisation of distributed programs by substitution of routines with equivalent but better-performing alternatives; on the other hand, this equivalence relation naturally induces a limit viewpoint for self-stabilising programs, complementing and integrating the two general (local and global) viewpoints by abstracting away the transitory characteristics and isolating the input-output mapping corresponding to the distributed algorithm. These viewpoints effectively constitute different semantic interpretations of a same program: operational semantics (local viewpoint), denotational semantics (global viewpoint), and eventual behaviour (limit viewpoint).

A fourth "continuous" viewpoint is considered in [START_REF] Beal | Self-adaptation to device distribution in the Internet of Things[END_REF]: as the density of computing devices in a given area increases, assuming that each device takes inputs from a single continuous function on a space-time manifold, the output values may converge towards a limit continuous output. Programs with this property are called consistent, and have a "continuous" semantic interpretation as a transformation of continuous functions on space-time manifolds. Taking inspiration from self-stabilisation, this notion is relaxed for eventually consistent programs, which are only required to continuously converge to a limit except for a transitory initial part, provided that the inputs are constant (except for a transitory initial part). Eventual consistency can then be proved for all programs expressible in the GPI (gradient-following path integral) calculus, that is a restriction of the field calculus where the only coordination mechanism allowed is the GPI operator, a generalised variant of the distance estimation building block.

Up to this point, hence, validation of behavioural properties is mostly addressed "by construction", namely, proving properties on simple building blocks or restricting the calculus to fragments. It is a future work to consider the applicability of techniques such as the formal basis in [START_REF] Lluch-Lafuente | Asynchronous distributed execution of fixpoint-based computational fields[END_REF], or model-based analysis such as [START_REF] Bakhshi | Mean-field framework for performance evaluation of pushpull gossip protocols[END_REF].

Protelis: a DSL for field calculus

The concrete usage of HFC in application development is conditioned by the availability of practical languages, embedding an interpreter or compiler, as well as handling runtime aspects such as communication, interfacing with the operating system, and integration with existing software. Protelis [START_REF] Pianini | Protelis: practical aggregate programming[END_REF] provides one such implementation, including: (i) a concrete HFC syntax; (ii) an interpreter and a virtual machine; (iii) a device interface abstraction and API; and (iv) a communication interface abstraction and API.

In Protelis, the parser translates a Protelis source code file into a valid representation of the HFC semantics. Then, the program, along with an execution context, is fed to the virtual machine that executes the Protelis interpreter at regular intervals. The execution context API defines the interface towards the operating system, including (with ancillary APIs) an abstraction of the device capabilities and the communication system. This architecture has been proven to make the language easy to port across diverse contexts, both simulated (Alchemist [START_REF] Pianini | Chemical-oriented simulation of computational systems with ALCHEMIST[END_REF] and NASA World Wind [START_REF] Bell | NASA world wind: Opensource GIS for mission operations[END_REF]) and real-world [START_REF] Clark | Distributed recovery for enterprise services[END_REF].

The entire Protelis infrastructure is developed in Java and hosted on the Java Virtual Machine (JVM). The motivation behind one such choice is twofold: first, the JVM is highly portable, being available on a variety of architectures and operating systems; second, the Java world is rich in libraries that can be directly used within Protelis, with little or no need of writing new libraries for common tasks.

The model-to-model translation between the Protelis syntax and the HFC interpreter is operated by leveraging the Xtext framework [START_REF] Bettini | Implementing Domain-Specific Languages with Xtext and Xtend, 2E[END_REF]. Along the parser machinery, this framework is able to generate most of the code required for implementing Eclipse plug-ins: one such plug-in is available for Protelis, assisting the developer through code highlighting, completion suggestions, and early error detection.

The language syntax is designed with the idea of lowering the learning curve for the majority of developers, and as such it is inspired by languages of the Cfamily (C, C++, Java, C#...), with some details borrowed from Python. Code can be organised in modules (or namespaces) whose name must reflect the directory structure and the file name. Modules can contain functions and a main script. The code snippet in Figure 3 offers a panorama on the ordinary and fieldcalculus specific features of Protelis, including the ability of importing libraries and static methods, using functions as higher-order values in let constructs and by apply, tuple and string literals, lambdas, built-ins (e.g., minHood, and mux), and field calculus constructs rep and nbr.

Function definitions are prefixed by the def keyword, and they are visible by default only in the local module. In order for other modules to access them, the keyword public must be explicitly specified. Other modules can be imported, as well as Java static methods. Types are not specified explicitly: in fact, Protelis is duck-typed-namely, type-checked at run-time through reflection mechanisms. The language offers literals for commonly used numeric values, tuples, and strings. Instance methods can be invoked on any expression with the same "dot" syntax used in Java. Higher order support includes a compact syntax for lambda expressions, closures, function references, functions as parameters and function application. Lastly, context properties, including device capabilities, are accessible through the self keyword. Environment variables can be accessed via the short syntax env. A relevant asset of Protelis is its recently developed library "protelis-lang" [START_REF] Francia | Towards a foundational API for resilient distributed systems design[END_REF], streamlining the implementation of several algorithms found in literature devoted to development of distributed systems. Among others, it includes several implementations of self-stabilising building functions [START_REF] Beal | Building blocks for aggregate programming of self-organising applications[END_REF][START_REF] Viroli | Engineering resilient collective adaptive systems by self-stabilisation[END_REF], such as distanceTo to estimate distances, broadcast to send alerts, summarize to perform distributed sensing, and so on. Notably, the library also includes machinery for "aligning" aggregate computing programs along arbitrary keys, separating and mixing domains in a finer way than the if construct allows. These constructs, based on the alignedMap primitive of Protelis, enable highly dynamic meta-algorithms to be written, that open to new possibilities such as multiInstance [START_REF] Francia | Towards a foundational API for resilient distributed systems design[END_REF], or allow for increased resilience and adaptation as in the case of timeReplicated [START_REF] Pianini | Improving gossip dynamics through overlapping replicates[END_REF].

ScaFi: an API for the Scala programming ecosystem

From a pragmatical viewpoint, it is highly desirable to bridge the gap between field calculus-based DSLs and mainstream programming platforms and languages that embody, among others, the functional, object-oriented, and actorbased paradigms (i.e., the nowadays reference styles for in-the-small, in-the-large, and concurrent/distributed programming, respectively). Indeed, this can be critical to foster adoption, reducing accidental complexity through coherent syntax, semantics, and toolset, and paving the way to a more integrated programming experience.

External DSLs such as Protelis, despite the aid provided by DSL frameworks like Xtext [START_REF] Bettini | Implementing Domain-Specific Languages with Xtext and Xtend, 2E[END_REF], can require a lot of development and maintenance effort, since they must cover aspects ranging from language design to typing, and proper tooling must be provided to enable full interoperability with the target platform in static, runtime, and debugging contexts. By contrast, internal DSLs are an interesting alternative, for they are expressed in the host language and are de facto equivalent to an API: they more seamlessly interoperate, and reuse the syntax, semantics, typing, and tools of their host language, at the expense of reduced flexibility due to the constraints exerted by the host environment. Such considerations of pragmatism, reuse, and interoperability motivate ScaFi (Scala Fields) [START_REF] Casadei | Towards aggregate programming in Scala[END_REF], an aggregate computing framework including a fieldcalculus DSL internal to the Scala programming language [START_REF] Odersky | Unifying functional and object-oriented programming with Scala[END_REF], also integrated into the Alchemist meta-simulator [START_REF] Casadei | Simulating large-scale aggregate MASs with Alchemist and Scala[END_REF], as well as an actor-based platform for distributed aggregate systems [START_REF] Casadei | Programming actor-based collective adaptive systems[END_REF][START_REF] Viroli | On execution platforms for large-scale aggregate computing[END_REF]. The choice of Scala as the host language was inspired by its (i) interoperability across the JVM platform, (ii) seamless integration of the object-oriented and functional paradigms, with support for lightweight component-based programming (cf., traits and self-types), (iii) advanced features for type-safe library development (cf., implicits, generic type constraints), (iv) syntax flexibility and sugar (cf., by-name arguments), allowing to create fluent DSL-like APIs; and (v) prominent role in the scene of distributed computing frameworks (cf., Akka, Kafka, Spark). Concerning the platform perspective, instead, the use of actor-based abstractions is instrumental to the integration of aggregate-level functionality into existing distributed systems (e.g., developed with more traditional techniques), by exposing collective coordination events and data through message or event-like interfaces [START_REF] Casadei | Programming actor-based collective adaptive systems[END_REF].

Working with a general-purpose, multi-paradigm programming language like Scala gives to the hands of developers quite a lot of flexibility and power for what concerns design and implementation of field libraries and programs. Consider the example in Figure 4 for a taste of the programming style, including definition of a reusable block G (extending distance calculation [START_REF] Beal | Aggregate programming for the Internet of Things[END_REF][START_REF] Viroli | Engineering resilient collective adaptive systems by self-stabilisation[END_REF]), type-class-style assumptions on arguments via context bound "[V: Bounded]", tuples by syntax (.,.), and pattern matching (case .. =>).

An AggregateProgram instance acts simply as a function from an abstract

Context to an Export. Hence, for a platform to support local execution of field computations it is just a matter of instantiating an aggregate program (possibly mixing in components to provide access to platform-level functionality), preparing contextual information (i.e., previous state, sensor data, and messages from neighbours), and running a computation round according to the device lifecycle.

Aggregate Programming

Building upon these theoretical and pragmatic foundations, aggregate programming [START_REF] Beal | Aggregate programming for the Internet of Things[END_REF] elaborates a layered architecture that aims to dramatically simplify the design, creation, and maintenance of complex distributed systems. This approach is motivated by three key observations about engineering complex coordination patterns:

-composition of modules and subsystems must be simple and transparent; -different subsystems need different coordination mechanisms for different regions and times; -mechanisms for robust coordination should be hidden "under the hood", where programmers are not required to interact with them. Fig. 5. Aggregate programming abstraction layers. The software and hardware capabilities of particular devices are used to implement aggregate-level field calculus constructs. These constructs are used to implement a limited set of building-block coordination operations with provable resilience properties, which are then wrapped and combined together to produce a user-friendly API for developing situated IoT (Internet-of-Things)systems-picture adapted from [START_REF] Beal | Aggregate programming for the Internet of Things[END_REF].

Field calculus (and its language incarnations) provides mechanisms for the first two, but is too general to guarantee resilience and too mathematical and succinct in its syntax for direct programming to be simple. Aggregate programming thus proposes two additional abstraction layers, as illustrated in Figure 5, for hiding the complexity of distributed coordination in complex networked environments. First, the "resilient coordination operators" layer plays a crucial role both in hiding the complexity and in supporting efficient engineering of distributed coordination systems. First proposed in [START_REF] Beal | Building blocks for aggregate programming of self-organising applications[END_REF], it is inspired by the approach of combinatory logic [START_REF] Curry | Combinatory logi[END_REF], the catalogue of selforganisation primitives in [START_REF] Fernandez-Marquez | Description and composition of bio-inspired design patterns: a complete overview[END_REF], and work on self-stabilising fragments of the field calculus [START_REF] Damiani | Type-based self-stabilisation for computational fields[END_REF][START_REF] Viroli | Engineering resilient collective adaptive systems by self-stabilisation[END_REF][START_REF] Viroli | A calculus of self-stabilising computational fields[END_REF]. Notably, three key operators within this self-stabilising fragment cover a broad range of distributed coordination patterns: operator G is a highly general information spreading and "outward computation" operation, C is its inverse, a general information collection operation, and T implements bounded state evolution and short-term memory.

Above the resilience layer, aggregate programming libraries [START_REF] Francia | Towards a foundational API for resilient distributed systems design[END_REF][START_REF] Viroli | Efficient engineering of complex selforganising systems by self-stabilising fields[END_REF] capture common patterns of usage and more specialised and efficient variants of resilient operators to provide a more user-friendly interface for programming. This definition of well-organised layers of abstractions with predictable compositional semantics thus aims to foster (i) reusability, through generic components; (ii) productivity, through application-specific components; (iii) declarativity, through high-level functionality and patterns; (iv) flexibility, through low-level and finegrained functions; and (v) efficiency, through multiple components with coherent substitution semantics [START_REF] Viroli | Engineering resilient collective adaptive systems by self-stabilisation[END_REF][START_REF] Viroli | Efficient engineering of complex selforganising systems by self-stabilising fields[END_REF].

Within these two layers, development has progressed from an initial model built only around the spreading of information to a growing system of composable operators and variants. The first of these operator/variant families to be developed centred around the problems of spreading information, since interaction in aggregate computing is often structured in terms of information flowing through collectives of devices. A major problem thus lies in regulating such spreading, in order to take into account context variation, and in rapidly adapting the spreading structure in reaction to changes in the environment and in the system topology. Here, the gradient (i.e., the field of minimum distances from source nodes) in its generalised form in the G operator is what captures, in a distributed way, a notion of "contextual distance" instrumental to calculate information diffusion, and forms the basis for key interaction patterns, such as outward/inward bounded broadcasts and dynamic group formation, as well as higher-level components built upon these.

The widespread adoption of gradient structures in algorithms stresses the importance of fast self-healing gradients [START_REF] Beal | Fast self-healing gradients[END_REF], which are able to quickly recover good distance estimates after disruptive perturbations, and more "dependable" gradient algorithms in which stability is favoured by enacting a smoother self-healing behaviour [8]. Several alternative gradient algorithms have been developed, addressing two main issues. Firstly, the recovery speed after an input discontinuity, which has first been bounded to O(diameter) time by CRF (constraint and restoring force) gradient [START_REF] Beal | Fast self-healing gradients[END_REF], further improved to optimal for algorithms with a single-path communication pattern by BIS (bounded information speed) gradient [START_REF] Audrito | Optimally-self-healing distributed gradient structures through bounded information speed[END_REF], and refined to optimality for algorithms with a multi-path communication pattern by SVD (stale values detection) gradient [START_REF] Audrito | Compositional blocks for optimal self-healing gradients[END_REF]. Secondly, the smoothness and resilience to noise in inputs, first addressed by FLEX (flexible) gradient [8] and then refined and combined with improved recovery speed by ULT (ultimate) gradient [START_REF] Audrito | Compositional blocks for optimal self-healing gradients[END_REF].

To empower the aggregate programming tool-chain, other building blocks have been proposed and refined besides from gradients: consensus algorithms [START_REF] Beal | Trading accuracy for speed in approximate consensus[END_REF], centrality measures [START_REF] Audrito | Aggregate graph statistics[END_REF], leader election and partitioning [START_REF] Beal | Building blocks for aggregate programming of self-organising applications[END_REF], and most notably, collection. The collection building block C progressively aggregates and summarises values spread throughout a network into a single value, e.g., the sum or other meaningful statistics. Based itself on distance estimation through gradients, a general single-path collection algorithm has been proposed in [START_REF] Beal | Building blocks for aggregate programming of self-organising applications[END_REF] granting self-stabilisation to a correct value, then multi-path collection has been developed for improved resiliency in sum estimations [START_REF] Viroli | Engineering resilient collective adaptive systems by self-stabilisation[END_REF], and finally refined to weighted multi-path collection [START_REF] Audrito | Resilient blocks for summarising distributed data[END_REF] which is able to maintain acceptable whole network sums even in highly volatile environments. A different approach to collection has also proved to be effective for minimum/maximum estimates: overlapping replicas of non-self-stabilising gossip algorithms [START_REF] Pianini | Improving gossip dynamics through overlapping replicates[END_REF] (with an appropriately tuned interval of replication), thus combining the resiliency of these algorithms with self-stabilisation requirements.

Perspectives and Roadmap

Over the past decade, aggregate computing has moved from a fragmented collection of ideas and tools to a stable core calculus and a coherent layered framework for the engineering of distributed systems. Thus, even as the underlying theory continues to be developed, as shown in [START_REF] Viroli | Resiliency with aggregate computing: State of the art and roadmap[END_REF], a significant portion of research and development can shift to more pragmatic issues linked to applications and higher levels of the aggregate computing stack. In this section, we review a number of such research directions, which include elaboration of libraries (Section 4.1), techniques to control dynamics (Section 4.2), management of mobile devices and processes (Section 4.3), development of software platforms (Section 4.4), security (Section 4.5), and applications (Section 4.6).

Elaboration of Libraries

The most immediate and incremental line of future development for aggregate computing is the elaboration of the existing collection of libraries, to form a more broadly applicable and easier to use interface at the top of the aggregate computing stack. Some of these additions and refinements will be based on development of alternative implementations of core resilient building blocks (e.g., [START_REF] Audrito | Resilient blocks for summarising distributed data[END_REF][START_REF] Audrito | Optimally-self-healing distributed gradient structures through bounded information speed[END_REF][START_REF] Pianini | Improving gossip dynamics through overlapping replicates[END_REF]), while others are expected to capturing common design patterns and necessary functionalities specific to particular application domains. No particular highpriority targets are suggested at present for this development, however. Instead, this process is expected to be a natural incremental progress of ongoing maturation and professionalisation driven by issues discovered as the other lines of future development outlined below exercise the existing libraries to expose their current shortcomings and needs for enhancement.

Understanding and Controlling Dynamics and Feedback

Much of the work to date on aggregate computing has focused on the converged properties of a system, such as self-stabilisation [START_REF] Dolev | Self-Stabilization[END_REF][START_REF] Viroli | Engineering resilient collective adaptive systems by self-stabilisation[END_REF] and eventual consistency [START_REF] Beal | Self-adaptation to device distribution in the Internet of Things[END_REF]. These theoretical approaches, however, assume that the network of devices is often in a persistent quasi-stable state in which the set of devices, their connections to one another, and their environment all do not change for a significant length of time. In large scale systems, however, such quasi-stable states are typically rare and short-lived: there is almost always something changing with respect to some device, thus constantly injecting perturbations into the system. Prior compositional safety analysis regarding self-stabilisation and eventual consistency also does not apply in the case of systems involving feedback, and many applications do require feedback either directly between building blocks or indirectly via interactions with the environment.

The control theory literature has many well-developed tools for analysing the response of complex systems under perturbation and in the presence of feedback. The mathematical frameworks for such tools are not straightforward to adapt for application to aggregate computing building blocks, but with careful work may often still be applied, e.g., through identification of appropriate Lyapunov functions to bound the convergence behaviour of a building block. Early work in this area shows promise, enabling analysis and prediction of aggregate computing systems with feedback between building blocks [START_REF] Kumar | Toward predicting distributed systems dynamics[END_REF] and providing stability analysis and tight convergence bounds for particular applications of the G operator [START_REF] Dasgupta | A Lyapunov analysis for the robust stability of an adaptive Bellman-Ford algorithm[END_REF] and C operator [START_REF] Mo | Error in self-stabilizing spanning-tree estimation of collective state[END_REF]. An important area for future development is thus to expand these results to cover a large sublanguage of aggregate computing systems and to apply them in order to refine and improve the dynamical performance of building blocks.

Mobility of Devices and Processes

Another key area for expansion of aggregate computing, both in theory and practice, is better handling of mobility, aboth of devices and of processes dispersed through networks of devices. From a theoretical perspective, this is closely interwoven with the need for a deeper understanding of convergence dynamics, as systems with mobile devices or processes typically do not ever achieve the quasi-stable states required for self-stabilisation to hold. Instead, work to date has depended on the informal observation that "slow enough" mobility does not disrupt commonly used self-stabilising building blocks. Theoretical work is needed to predict and bound regions of stability and effects of perturbation, as well as to develop improved building block alternatives for conditions where the identified dynamics are unsatisfactory.

There is also a need to expand the existing building block libraries to support applications involving mobility. For controlling the physical motion of devices, a number of building blocks have been demonstrated or proposed throughout the swarm robotics and multi-agent systems literature, including a number already formulated as building blocks for aggregate computing (e.g., [START_REF] Bachrach | Composable continuous-space programs for robotic swarms[END_REF][START_REF] Beal | A tactical command approach to human control of vehicle swarms[END_REF][START_REF] Beal | Superdiffusive dispersion and mixing of swarms[END_REF]). We may also consider systems in which the device is not the focus of mobility, but instead code and processes dynamically deploy, migrate, upgrade, and terminate during system operation, as considered for example in [START_REF] Beal | Aggregate programming for the Internet of Things[END_REF][START_REF] Viroli | Aggregate plans for multiagent systems[END_REF]. To effectively support mobility in aggregate computing, the large volume of prior work on algorithms and strategies for such systems needs to be systematised and organised, analysed for compositional safety and bounds on convergence, and adapted for use in aggregate computing based on the results of analysis.

Software Platforms

Aggregate computing targets a number of application scenarios, generally characterised by inherent distribution, heterogeneity, mobility and lack of stable infrastructure (including computation, storage, and networking media). Hence, proper middleware or software platform is paramount to ease the development and deployment of applications as well as support their management at runtime [START_REF] Viroli | On execution platforms for large-scale aggregate computing[END_REF]. Moreover, such a layer is the ideal place where to encapsulate crosscutting concerns such as security, privacy, monitoring, fault tolerance and so on.

Though the problem of a middleware is common to almost any distributed computing effort, there are some issues (e.g., those discussed in this section, like mobility and control) and opportunities specifically related to aggregate computing and coordination that deserve attention. In particular, consider the aggregate programming model: it achieves a certain degree of declarativity by abstracting over a number of details such as, for instance, the specifics of neighbourhoodbased communication and the order and frequency of micro-level activities sustaining application execution-details that can be delegated to corresponding platform services for topology management, scheduling and round execution. This abstraction provides a lot of flexibility on the platform side, which is free to apply optimisations of various sorts, from simpler (e.g., avoid broadcasting redundant messages) to more complex ones. In fact, the most relevant insight here is the ability of running aggregate computing systems according to different execution strategies [START_REF] Viroli | On execution platforms for large-scale aggregate computing[END_REF], from fully peer-to-peer, where end-devices directly communicate between one another and run by themselves their piece of aggregate logic, to completely centralised solutions where, instead, end-devices act only as managers for sensors and actuators, sending perceptions upstream to one or more servers which run computations on their behalf and ultimately propagate actuation data downstream.

Crucially, this flexibility paves the way towards an opportunistic and QoSdriven exploitation of available infrastructural resources, as well as to intrinsic adaptation of application execution to forthcoming multi-layer architectures involving edge, fog, and cloud interfaces [START_REF] Viroli | On execution platforms for large-scale aggregate computing[END_REF]-as required to deal with emerging IoT scenarios. For instance, an aggregate system specification can be mapped to a system of actors [START_REF] Casadei | Programming actor-based collective adaptive systems[END_REF] where each actor is responsible for a specific aspect of the overall computation and communication and can be migrated to different machines while preserving coordination by automatically adapting the bindings [START_REF] Viroli | On execution platforms for large-scale aggregate computing[END_REF]. A lot of interesting future work is expected to be carried out in order to put such theory of adaptive execution coordination into practice.

Security

Security is a critical concern in computer science in general and especially in open environments, such as those envisioned in pervasive computing and IoT scenarios involving vast numbers of devices administered by individuals and organisations with no particular knowledge of security. This problem is multifaceted and requires carefully thought, full-stack solutions that also consider orthogonal issues such as, for instance, the cost of security-related computational tasks in resource-constrained devices.

A number of security issues, not strictly related to coordination, of prominent importance in real-world, trustworthy systems, can be addressed in the middleware layer and through proper deployment solutions. For example, support is needed to enable safe code mobility and execution, as proposed in [START_REF] Damiani | Code mobility meets self-organisation: A higher-order calculus of computational fields[END_REF], which may be required in scenarios characterised by significant dynamicity requirements or demands for automatic deployment of new functionality. Another key theme is confidentiality: privacy properties on the propagated and collected data need to be understood and guaranteed, otherwise participation may be hindered. Additionally, despite the decentralised and inherently scalable nature of aggregate systems, availability issues need to be considered, according to the specifics of applications, especially with respect to nodes playing a crucial role in algorithms (e.g., sources, hubs, collectors, region leaders).

Regarding application-level interaction, since coordination activity in aggregate computing is substantially based on a premise of cooperation between the participating entities, it is often sensitive to attacks that may trigger epidemic deviation. That is, what is the extent to which agents and their data can be trusted? In order to assess and mitigate the impact of voluntary or involuntary misbehaviour, adoption of computational trust has proven useful [START_REF] Casadei | Combining trust and aggregate computing[END_REF] and applicable even in decentralised settings, in which no central authority is available to certify recipients and endpoints, and in scenarios where seamless opportunistic interaction is the norm. Much work remains, however, to develop these initial proposals into a fully articulated theory and practice for the security of aggregate computing systems that takes into account confidentiality, integrity, availability, and authenticity issues.

Applications and Pragmatics

Finally, the core goal all along for the aggregate computing research thrust has been to enable simpler, faster development of more resilient distributed applications. Having developed both its theoretical foundations and the layered system of algorithms and libraries exploiting those foundations, one of the major directions of current and future work is indeed to apply these developments to real-world problems across a variety of domains.

One key application area, previously discussed in [START_REF] Beal | Aggregate programming for the Internet of Things[END_REF] and other works, is pervasive or IoT scenarios in dense urban environments. As the density of communicating devices increases, their interactions put pressure on the available fixed infrastructure and the opportunities for local interaction increase. This is particularly acute during transient events when demand and the available infrastructure become mismatched, such as during festivals or sporting events when the number of people packed into an area spikes, or during natural disasters and other emergencies when the available infrastructure may be degraded. One of the critical challenges in this area is simply to access the potential peer-topeer capabilities of devices, which are often closed platforms and are currently typically configured primarily for asymmetrical communication with fixed infrastructure or individually connected personal networks. These constraints are both loosening over time as app infrastructures continue to spread and develop on many platforms. Finally, the benefits of distribution must be effectively balanced with tight energy budgets on many devices and the continuous value of non-local interactions enabled by cloud connections.

Another important emerging application area is control of drones and other unmanned vehicles, driven by the rapidly increasing availability of high-quality platforms at various levels of cost and capability. With the emergence of highly capable autopilots, the need for detailed human control is decreased and it becomes desirable to shift from the current typical practice of multiple people commanding a single platform toward a single person controlling many platforms. Aggregate computing is a natural fit for approaching multi-platform control, using paradigms such as those discussed in [START_REF] Bachrach | Composable continuous-space programs for robotic swarms[END_REF] and [START_REF] Beal | A tactical command approach to human control of vehicle swarms[END_REF]. In implementation, however, the challenges of mobility become acute as one considers rapid physical movements. Likewise, a better understanding of convergence dynamics and feedback will be needed. Work in this space will also demand significant elaborations in aggregate computing libraries, adapting manoeuvres from the applicable literature and doctrine into additional composable building block components. Finally, there are also major pragmatic issues to be addressed in platform interfaces, including a plethora of standards, safety issues, and appropriate incorporation of resource and manoeuvring constraints.

Agent-based planning uses similar principles, computing plans for future actions over an aggregate of agents. This generalisation, however, typically also connects representations of future plans, tasks, goals, and environment into the aggregate [START_REF] Viroli | Aggregate plans for multiagent systems[END_REF], as some combination of additional virtual devices in the aggregate and virtual fields that devices can interact with. Examples include the poly-agent approach to modelling and planning [START_REF] Parunak | Concurrent modeling of alternative worlds with polyagents[END_REF] and agent-based sharing of airborne sensors [START_REF] Beal | Opportunistic sharing of airborne sensors[END_REF][START_REF] Beal | Adaptive task reallocation for airborne sensor sharing[END_REF]. When agent-based planning is centralised, managing projections and tasks is straightforward; when distributed across physical agents, however, there are important questions to be addressed regarding where projections and tasks should be hosted, to what degree they should be duplicated, and how to synchronise information between duplicates.

Aggregate computing can also be applied to more conventional networked systems. In this case, the links between neighbours are defined by (not particularly spatial) physical network connections, virtual network relationships such as in an overlay network, or else logical relationships such as interaction patterns between services. As long as the number of such neighbours is relatively constrained, such that sending regular updates to neighbours is not problematic, many of the same sorts of coordination approaches that work in other application areas can work in areas such as these as well. Examples of applications in this space include coordinating recovery operations for networks of enterprise services [START_REF] Clark | Distributed recovery for enterprise services[END_REF], coordinating a checkpoint-based "rewind and replay" across interacting services to undo the effects of a cyber-attack [START_REF] Beal | Aggregate programming: From foundations to applications[END_REF], and integrating applications across intermittently connected distributed cloud nodes [START_REF] Beal | Aggregate programming: From foundations to applications[END_REF]. In this domain, in most cases it is not cost-effective to try to write or refactor entire services and applications into an aggregate computing paradigm. Instead, aggregate computing appears better used as meta-level coordination and control service, helping to determine things like when and where to migrate services across machines, how many instances of a service should be used, how to rendezvous between services that need to communicate, and so on. Future work in this space is thus likely to focus on extending libraries to better support various coordination paradigms, particularly with distributed graph algorithms for supporting coordination regarding dependencies and information flows, and on the pragmatics of interfacing with complex legacy applications.

In addition to the four presented here, aggregate computing offers potential value in many other application domains as well: it is likely to offer value in any domain with an increasing number and potential volatility in collections of devices capable of communicating locally. The ongoing continuation of miniaturisation and embedding of computational devices means this is likely to apply in most areas of human endeavour, to one degree or another. Across all such domains, just as in the four domains described in detail, it is likely to be the case that aggregate computing will not be the focus of the system but rather, much like any other specialised library, used as a modular component: and most specifically, as a component providing a coordination service. A critical challenge for the future, then, will be to continue shaping and improving libraries and interface patterns in response to the needs of these application domains, in order to allow aggregate computing to become as invisible as possible in the actual process of systems engineering.

Conclusions

Aggregate computing is a potentially powerful approach to the engineered distributed systems, emerging from the distillation of a wide variety of approaches to coordination into the field calculus. This mathematical core then serves as the basis for a layered approach to pragmatic development of composable and resilient distributed systems. The future of aggregate programming involves both continued development of its core theoretical tools as well as work to realise its potential across a wide range of important application domains.

Fig. 2 .

 2 Fig. 2. Example field calculus code

traitFig. 4 .

 4 Fig. 4. Example ScaFi code

Much as λ-calculus[START_REF] Church | A set of postulates for the foundation of logic[END_REF] captures the essence of functional computation and FJ[START_REF] Igarashi | Featherweight Java: A minimal core calculus for Java and GJ[END_REF] the essence of class-based object-oriented programming.

supported by: EU Horizon 2020 project Hy-Var (www.hyvar-project.eu), GA No. 644298; ICT COST Action IC1402 ARVI (www.cost-arvi.eu); Ateneo/CSP D16D15000360005 project RunVar (runvar-project.di.unito.it). This document does not contain technology or technical data controlled under either U.S. International Traffic in Arms Regulation or U.S. Export Administration Regulations.