~~CLOSETOC~~
<html><font color=#ffc960 size="+2"><b>What is Reactive Programming?</b></font></html>



====Overview====

Reactive programming is a declarative approach for expressing data dependency logic. By using some form of Data Definition Language you define a dependency between data elements, that causes a dependent element to automatically change in reaction to changes in another element.  Current examples of this are Functions in a Spreadsheet that automatically re-calculate the value of a cell based on changes in another cell, or Triggers in a database that can change data in a child table as a consequence of data changing in the parent.

In dataspaces, reactive dependencies are defined by assignment expressions.  Conceptually, we can say ''A<--(B + C)'', wherein A automatically reacts to changes in B or C at some future time.  Once a relationship between data elements is declared, re-calculation of A happens automatically.  Furthermore, if A itself is used for assignment to declare a reactive dependency, for example ''D<--(A)'' then changes to B and C are automatically propagated to D.  In mathematics this is known as a [[wp>transitive relationship]].

StreamScape allows users to declare reactive dependencies between servicesBy contrast, in imperative (procedural) programming ''A = B + C'' is an assignment statement, wherein A is set when the assignment statement executes. Subsequent changes to B or C do not affect A, unless you specifically re-calculate A. Programmers are responsible for understanding and managing these dependencies as well as relationships between data elements.

The [[whats_app|StreamScape data fabric]] is a distributed, reactive programming engine. It allows users to raise events and process them anywhere in a location-transparent manner.  The engine takes care of managing data dependencies, network communications, sending and receiving of messages, data serialization and security.  The fabric also handles propagation of events to participating components in a source-ordered fashion, allowing users to declare reactive dependencies between service components, data and application logic through the use of [[#event handlers| Actors]], [[#RPL functions|functions]] and [[#event triggers]]. Event structure may be declared using script-like syntax or imported from Java objects, XML and JSON sources.

Collectively the environment for defining reactive logic is referred to as Reactive Programming Language script or simply RPL script ((Pronounced Ripple-Script by those in the know)).  The application fabric makes implicit use of the so-called [[basic_concepts#Message Passing Interface]], a form of messaging that allows many participant applications to simultaneously exchange complex data structures (ie. documents) in a location-transparent fashion. The underlying engine is an event dispatcher that makes use of the [[wp>observer pattern]], allowing millions of events to be processed per second inside a single node and scale across CPU in a linear fashion. The fabric integrates data flow concepts into the data language, making it easy for users to define implicit observers such as event triggers and actors.  This allows for fine-grained data flow and simplifies parallel computing, resulting in so-called [[wp>implicit parallelism]] which allows users to automatically exploit parallel computing capabilities of networked computing systems without the need for writing special programs to do so.

Unlike traditional computing languages used for expressing procedural logic between data constructs (ie. variables or data objects), RPL is a distributed computing language that includes declarative capabilities for defining dependencies between components without the need to understand messaging, networking or stream processing.  RPL is interpritive and does not require compilation.  It it not [[wp>Turing Complete]] (not a general purpose language) but may be extended through the use of DSL or user-defined functions written in Java.  Results of computations may be easily passed to components running on different machines by raising events and defining actors or triggers on event queues and event tables.

====The Reactive Manifesto====

[[http://www.reactivemanifesto.org/]]