Reactive Context-Aware Programming (ReCAP) extends the ambient-oriented programming paradigm to tailor it for the Internet of Things (IoT): a network environment in which physical objects are given an embedded digital representation.
This enables IoT applications to detect the proximity and/or availability of physical objects and use this information to provide context-sentive services and information. The ReCAP paradigm supports the development of such application as follows.
† Quick-link: Reactive programming
IoT applications are causally connected to their environment; the presence, proximity and current state of nearby devices and physical objects is used to customize the services and information offered by the application.
Reacting to changes in the environment requires registering one or more event handlers. For instance, if an AmbientTalk application wants to respond to the appearance and disappearance of nearby devices, it has to register
whenever:disconnected event handlers.
The use of such event handlers introduces an inversion of control, where the control flow of the application is scattered across a number of event handlers. This inversion of control is particularly jarring if the application logic demands the use of additional event handlers to propagate environmental changes to modules which are only indirectly affected by them.
Note that it is often possible to avoid the inversion of control altogether. For instance, to abstract over (dis)appearing communication partners, one can use an ambient reference. In the general case, the inversion of control can often be removed through the use of reactive values.
† Quick-link: Pattern matching
One of the key elements of the IoT is that all physical objects are equipped with an embedded digital representation (e.g. using an RFID tag). Given the premise that the presence of any given object can be a cue that steers the application of IoT applications, it is crucial that programmers have adequate tools to describe the applications window on the world.
The window on the world denotes the set of physical objects and devices whose presence or absence has to be reported to the application. Determining whether an object is visible in an application’s window on the world may depend on its type, current state, as well as on the presence or absence of other objects.