Functional Reactive Programming (FRP)

FRP is a declarative programming model for building interactive apps based on a continuous model of time. FRP programs are described in terms of behaviors and events. While this paradigm is anything but new, it became fashionable on the JVM with the appearance of RxJava library.

RxJava, which is modeled after the .Net version of Rx, is essentially extending the observable pattern to allow composition of event sequences in such a way that concurrency concerns are completely abstracted away.

Basic concepts


The Observable interface is implementing the Reactive Pattern. This interface provides overloaded methods for subscribing as well as delegate methods to the various operators.



The Observer interface provides a mechanism for receiving push-based notifications.


Now that the basic terminology is out of the way, let's see a few quick examples in Scala:



If you are coming from Finagle or Akka you will quickly become conformable with RxJava. Having a Javascript implementation and a rich ecosystem, helps too.