官术网_书友最值得收藏!

Reactive Programming techniques

Reactive Programming is event-based in most cases. In Reactive Programming, the APIs are exposed in the following two flavors:

  • Callback: In this type, the anonymous routines are registered to event sources as callback functions. They will be invoked when the event is triggered by the data flow.
  • Declarative: The events are observed through well-defined functional compositions, like a filter, map, and other stream-based operations, like count, trigger, and so on.

Reactive Programming puts the importance on data flow rather than the flow of control, so it is not uncommon to consider it as a data flow programming. There are various techniques that are used to achieve Reactive Programming as follows:

  • Futures and promise: It is referred to as a technique to define the variable and assign its value. Though futures and promise are used interchangeably, they are not exactly the same. The future is used to describe a read-only view of a variable (or, say, define the variable), while the promise is a writable, single assignment container that is used to set the value of a variable in future. 
  • Reactive Streams: It is defined as a standard for the processing of asynchronous streams that enables non-blocking, backpressure transmutations between sources from where the events are initiated and the destination where they are observed.
  • Data flow variables: It is a variable whose value depends on a given input, operations, and other cells, and is updated automatically when changes happen to source entities. You can think of a data flow variable as a spreadsheet cell, where a change in the value of one cell causes a ripple effect to others based on the assigned formula.

In addition to this, there are various frontend libraries available, like React.js, AngularJS, Ractive.js, Node.js, and so on, which are used to develop reactive frontend applications. Other programming languages and frameworks providing native support for reactive applications are Scala, Clojure, and GoLang, along with Java 9 and Spring 5. We will see reactive features of Spring 5 later in this chapter.

主站蜘蛛池模板: 榆社县| 瑞丽市| 炉霍县| 封开县| 马鞍山市| 泰州市| 正镶白旗| 平顶山市| 阜新| 湘阴县| 玉门市| 长宁区| 定安县| 红桥区| 宣汉县| 沧州市| 玛沁县| 奈曼旗| 茂名市| 读书| 同江市| 武乡县| 漠河县| 长宁区| 法库县| 诸城市| 新余市| 临清市| 饶平县| 承德县| 玉田县| 巨野县| 鹤庆县| 滨州市| 青神县| 长沙市| 平潭县| 夏河县| 平凉市| 城口县| 博罗县|