Codementor Events

Intro to Reactive Functional Programming

Published Jan 09, 2019
Intro to Reactive Functional Programming

Originally posted on: https://www.linkedin.com/learning/reactive-programming-with-java-8

Intro

In the modern computing environment, there are more users with heavier usage patterns and much higher expectations for user experience. Many applications are starting to be deployed on highly distributed cloud servers which come with their own set of complications.

To address these concerns, 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.

  • 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 gif.gif

The diagram featured above is called a marble diagram and they are commonly used to explain various aspects about reactive streams.


The Reactive Manifesto

Before you start your journey into building reactive systems you should check out the Reactive Manifesto. The Reactive Manifesto explains various characteristics that Reactive Systems should possess.

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 tend to be easier to develop and change as the systems evolve and grow.

Reactive Systems need to be:

  • Responsive
  • Resilient
  • Elastic
  • Message Driven

Let’s take a look at the interplay of these characteristics:
reactive-manifesto.gif

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!


https://www.linkedin.com/in/anataliocs

Originally published at https://www.linkedin.com on July 22, 2018.

Discover and read more posts from Chris Anatalio
get started
post commentsBe the first to share your opinion
Show more replies