Handling RxJava Observables in a Web UI

Before we dive into the meat of this article, let's start with some definitions.

RxJava: A Java VM implementation of Reactive Extensions: a library for composing asynchronous and event-based programs by using observable sequences. It is popular, as it addresses the concerns about low-level threading, synchronization, thread-safety and concurrent data structures.

Difference Between Observable and Promise in Angular 8

Introduction 

Observable and Promise both provide us with abstractions that help us deal with the asynchronous nature of applications.

Promise

Promises work with asynchronous operations. They either return a single value (i.e the promise resolves) or an error message (i.e the promise rejects).

Introduction to Reactive Programming

Reactive programming is about dealing with data streams and the propagation of change.

Reactive systems are applications whose architectural approach make them responsive, resilient, elastic and message-driven.

Constructor Value Vs. Observer in Java

Who wins in the battle between Constructor Values and the Observer? Well, it depends.

Who Belongs to Whom?

It is common to connect two components using constructor parameters. This procedure can be seen very clearly, for example, in the construction of graphic surfaces. Take the following source code:

public class SubView {
  private MainView mainView;
  public SubView(MainView mainView) {
    this.mainView = mainView;
  }
  public void buttonClicked(String input) {
    mainView.setInputValue(input);
  }
}