78

I have been doing some research into reactive programming recently and I'm finding it hard to find a good description of the difference between Reactive and Functional-Reactive.

Is it simply that the reactive programming is implemented using functional methods/paradigms as opposed to using declarative or OO paradigms?

seadowg
  • 4,033
  • 6
  • 32
  • 43

2 Answers2

77

Functional Reactive Programming (FRP) is a specific programming model with a specific semantics. (Actually, there are two variants, which are sometimes called "classic FRP" and "arrow FRP".) I've given a summary in an answer to "What is (functional) reactive programming?". As I said there, the two key properties for me have always been (a) precise & simple denotation and (b) continuous time. I regret that this model came to be called "functional reactive programming", for a few reasons:

  • That name omits "time", and time is central for me.
  • The term "functional" has so little specific/clear meaning. I much prefer Peter Landin's suggested replacement "denotative". (See the quotes and reference in this blog comment.)
  • It's easy for people to incorrectly think they know what the term means because they know meanings (more or less) of each of the three words.

For descriptiveness & accuracy, I prefer the term "denotative continuous-time programming" (suggested by Jake McArthur in a conversation a while back) over "functional reactive programming".

I wrote a very short piece on the origin of FRP in the blog post Early inspirations and new directions in functional reactive programming.

Community
  • 1
  • 1
Conal
  • 18,206
  • 2
  • 34
  • 40
26

FRP is a combination of Functional programming(programming paradigm built upon the idea of everything is a pure function) and reactive programming paradigm (built upon the idea that everything is a stream(observer and observable philosophy)). It is suppose to be the best of both the worlds.

The definition of both give a more clear distinction between the two.

Krishna Ganeriwal
  • 1,555
  • 15
  • 15
  • 1
    great overview :) – Brahem Mohamed Nov 27 '18 at 12:39
  • Could you go into more depth? I like your explanation, but when I use reactiveX (e.g. RxJava), I am reactive but not necessarily functional? Because within the reactive functions (chain) I can still have side effects or be non-idempotent (not functional). – Ben Butterworth Jan 23 '21 at 21:12
  • What you assume is correct @BenButterworth Using RxJava or for that matter any reactive library does not guarantee functional behavior. It is the developer's duty to ensure no side effects. – Krishna Ganeriwal Feb 05 '21 at 05:49