I've recently started dig into the Functional Reactive Programming paradigm, and I wanted to know what you are thinking about it! If you have any experience with it, please share your thoughts, I would enjoy reading about it. :)
I have recently got started with reactive programming. Infact, I asked on a question on hashnode about it and got some amazing answers, which really got me going.
So far, I have found this to be amazing. The idea that you can turn any operation into an observable event stream which you can listen to and then trigger some other event is powerful.
Over the past years, I have used Reactive programming every now and then. Let me give you a short description of what reactive programming really is:
Let's take a quick example here -- say you want to cook biryani (it's a delicious rice-based dish, native to India). One way to do that would be the old-fashioned synchronous way of waiting for everything in a line:
Here, you'll be exhausted in the end, and just sleep. All the cooking, in vain.
The async., reactive way here will be:
You can clearly see that the second one is better. It gets the thing done quickly, with less pain and hassle. And here, I very cunningly, described the Pub-Sub model as well. All of this, is reactive programming: waiting for async. data flows.
If you've read any of my answers, you must've realised that I keep on blabbering about messaging queues and whatnot. Well, you can use reactive programming with it, but now reactive functional programming. With JavaScript, you get the best of both worlds.
A place where I used this in production was -- I was making an image verification system; I'll spare you the gory mathematical details, but just to filter the spam, we had to see if it was a face in the first place. Since we had multiple requests streaming in, we pushed it to a queue, and subscribed to its
onHaarComplete(it's a preliminary wavelet transform for the Viola-Jones facial detection algorithm) event.Personally, I am a huge fan of Reactive functional programming. You can throw functions, apply data-reduction algorithms, wait for it (last HIMYM reference, I promise) and what not.
Being someone who has written backends in Ruby as well, this definitely makes life simpler!
I hope this helps! :)