archives

The Regiment Macroprogramming System

I read this recently and found it very interesting. Paper here. Abstract:

The development of high-level programming environments is essential if wireless sensor networks are to be accessible to nonexperts. In this paper, we present the Regiment system, which consists of a high-level language for spatiotemporal macroprogramming, along with a compiler that translates global programs into node-level code. In Regiment, the programmer views the network as a set of spatially-distributed data streams. The programmer can manipulate sets of these streams that may be defined by topological or geographic relationships between nodes. Regiment provides a rich set of primitives for processing data on individual streams, manipulating regions, performing aggregation over a region, and triggering new computation within the network.

In this paper, we describe the design and implementation of the Regiment language and compiler. We describe the deglobalization process that compiles a network-wide representation of the program into a node-level, event-driven program. Deglobalization maps region operations onto associated spanning trees that establish region membership and permit efficient in-network aggregation. We evaluate Regiment in the context of a complex distributed application involving rapid detection of spatially-distributed events, such as wildfires or chemical plumes. Our results show that Regiment makes it possible to develop complex sensor network applications at a global level.

Also, earlier work covered here.

What I really like this paper is the way they combine continuous-time FRP signals with spatial regions of nodes. A signal S has a time component, and can be mapped (smap) or combined as a signal, but also has a spatial component and so can support filtering (rfilter) and folding (rfold). rfilter is useful for reducing communication of unimportant changes to save power, while rfold allows for result aggregation at intermediate points in the sensor network. They provide special operators for defining regions based on node topology, so you can program your whole sensor network as simply one FRP program (aka macro programming).

The alternative would be to program each node individually and let global behavior merge from how node's interact. This approach is also appealing. Diffusion is mentioned as one possible micro programming model, and so maybe the Anti-objects approach would contrast with the macro-programming approach for time-dependent spatial programming.

Declarative binding vs. composition

Recently, I've been trying to come to grips with pure functional programming (e.g., Haskell) and other potential kinds of declarative languages that work at the level of declarative binding rather than functions (e.g., constraint languages). As an example of the difference, consider how to make a button blue. Using functions, we define a function that creates a new button that is blue; e.g.,

make_blue(button) -> button
let my_blue_button = make_blue(my_original_button) in ...

The point of the pure functional approach is that we create new values to reflect new desired realities. Now for the declarative binding (constraint) approach:

is_blue_button(a_button) => a_button.background = blue
...
assert is_blue_button(my_button)

The point of the declarative binding approach is that we refine existing values declaratively to reflect desired realities. Different approach, same result I guess. For reactive programming, I've always been interested in the declarative binding approach with SuperGlue vs. the compositional approach of FRP. However, both approaches seem to have their benefits and drawbacks. Explicit function application gives you more immediate control over the values you produce, but without universal quantification we have to explicitly encode conditions around each application site. Implicit bindings allows things to "just happen" when the right conditions are met, but sometimes we have to struggle to control what goes on.

Any thoughts about the different styles?