Kinja Technology
Kinja Technology

Functional Reactive Programming (FRP)

Illustration for article titled Fiddling with RxJava
Advertisement

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.

Advertisement

Basic concepts

Observable

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

Advertisement

Observer

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

Advertisement

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

Advertisement

Conclusion

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.

Share This Story

Get our newsletter