Intro to Reactive Functional Programming
Tags: java, functional, angular, javascript
Published: 2019-12-27 01:30:58

---
title: Intro to Reactive Functional Programming
published: true
description: Reactive Functional Programming intro and links
tags: java, functional, angular, javascript
cover_image: https://thepracticaldev.s3.amazonaws.com/i/f4mxkivspz432ikfjc8j.png
---

*Excerpts from my courses: https://linkedin-learning.pxf.io/reactive-java-8 and https://linkedin-learning.pxf.io/full-stack-reactive-app-java-spring-angular*

---

# Intro

In modern web and mobile environments, there are more users with heavier usage patterns and much higher expectations for user experience then ever before. Many applications are deployed on highly distributed cloud servers.

To address these challenges, many engineering teams are turning to the Reactive Functional paradigm of programming.

This article will give you a brief introduction to **Reactive Functional Programming**.

---

# What is Reactive Programming?
> Interactive programs work at their own pace and mostly deal with communication, while reactive programs only work in response to external demands and mostly deal with accurate interrupt handling.
*Gérard Berry (Director of Research at INRIA)*

*Reactive programming* is a declarative programming paradigm that entails building asynchronous, non-blocking and event-driven applications that leverage asynchronous data streams and can easily scale across distributed systems.

**A Stream can emit three things:**
- A value
- An error
- A completed signal

## What are Asynchronous Data Streams?
A stream is a sequence of ongoing events ordered in time. Examples of events include variables, user input, properties or click events.

![Reactive Streams in Action Marble Diagram](https://thepracticaldev.s3.amazonaws.com/i/ctopogp8yskfuzz5bzav.gif)
*Reactive Streams in Action Marble Diagram*

The diagram featured above is called a [marble diagram](https://rxmarbles.com/) and they are commonly used to explain various aspects about [reactive streams](https://www.reactive-streams.org/).



---

# The Reactive Manifesto

Before you start your journey into building reactive systems you should check out the Reactive Manifesto. The [Reactive Manifesto](https://www.reactivemanifesto.org/) explains various characteristics that Reactive Systems should possess.

Check out and sign the manifesto here: [https://www.reactivemanifesto.org/](https://www.reactivemanifesto.org/).

*Reactive Systems* tend to be loosely-coupled, flexible and very scalable. Built the right way and given time for engineering teams to adapt to the new paradigm, these systems will be more adaptable to change as you scale and evolve the system.

**Reactive Systems need to be:**

- Responsive
- Resilient
- Elastic
- Message Driven

Let’s take a look at the interplay of these characteristics:

![Reactive Manifesto in Action](https://thepracticaldev.s3.amazonaws.com/i/2y7chilnwxx7xl95oeks.gif)
*Reactive Manifesto in Action*

We can see that message-driven systems help facilitate elastic and resilient characteristics which in turn help to make the entire system more responsive. 

Building responsive systems with a great user experience is the end-goal of the Reactive Manifesto!

---

## Why Reactive Programming?

The transition to Reactive Systems can be a very challenging and time-consuming endeavor.

**However, consider the following:**

- Modern systems need to be robust, resilient and flexible
- They are deployed on cloud-based clusters running thousands of multi-core processors
- Users expect millisecond response times and ~100% uptime
- Data is measured in Petabytes
- Modern systems need to be tolerant of failure and to fail gracefully as well as being highly responsive while giving users effective, interactive feedback

Building reactive systems is a great solution for these challenges. 

So do yourself a favor and start learning more about the Reactive Functional Paradigm and how it can help systems at your organization become more future-proof and scalable!

---

## Other platforms

Reactive programming is not limited to any one platform.The ReactiveX project provides implementations in many different languages: [http://reactivex.io/](http://reactivex.io/)

Including Javascript: [https://www.learnrxjs.io/](https://www.learnrxjs.io/)

Other Reactive Functional Javascript frameworks include:
- [https://cycle.js.org/](https://cycle.js.org/)
- [https://baconjs.github.io/](https://baconjs.github.io/)

Frameworks that implement the [Reactive Streams](https://www.reactive-streams.org/) specification are interoperable.



---

Check out my courses on LinkedIn Learning for a deeper dive into these topics:

- [Building a Full-Stack Reactive App with Angular and SpringBoot 2](https://linkedin-learning.pxf.io/full-stack-reactive-app-java-spring-angular)
- [Reactive Java 8](https://linkedin-learning.pxf.io/reactive-java-8)
- [Reactive Spring](https://linkedin-learning.pxf.io/19QKz)