Aggregate computing, step by step
Eight short chapters. Each one introduces an idea, shows it running on a simulated network, and ends with exercises.
The idea
Usually you program one device at a time: what it sends, to whom, how it reacts. With aggregate computing you describe what the whole network should compute: a field, one value per device, such as the distance from a point or the number of neighbours. Every device runs the same program, and the runtime takes care of the messages.
The theory behind it is the field calculus, now generalised as the eXchange Calculus (XC): the model of ScaFi, FCPP and Collektive. There are only a few operators; everything else is built by composing functions.
The simulator
Every chapter has simulated networks like this one. The editor holds the program: change it and the network restarts with the new code.
- Click a node to switch its
sourcesensor on or off; shift+click forobstacle. - Drag a node to move it; range is how far two nodes can be and still be neighbours.
- Hover a node to see its value and the message it sends, with its size over Bluetooth.
Chapters
- Rounds and state: how a program runs, and
rep. - Neighbours and fields:
nbr, and reducing a field to a value. - The gradient:
shareand a first distributed algorithm. - Composing functions: reusable blocks and the standard library.
- Alignment and branches: what happens around an
if. - xc: a different message for each neighbour.
- Sensing and acting: inputs, outputs and the world around the program.
- On devices: the same code on Puck.js and ESP32.
- Real networks: lost messages, the Bluetooth format, rounded numbers.