Reactive and Dataflow Programming

In most paradigms you decide when things happen: call this, then that. In reactive and dataflow programming you describe how values depend on each other, and the system runs the right computations when inputs change. A spreadsheet is the everyday example: change cell A1 and every formula that uses it updates.

Streams of Values Over Time

The core idea is the stream (or observable): a sequence of values that arrive over time, such as mouse clicks, sensor readings, keystrokes or server messages. A program is a set of streams connected by transformations. You write what a result is, for example "the search box text, after the user pauses, without duplicates", instead of writing the timers and flags that produce it.

Operators and Pipelines

Streams are transformed with operators similar to those for lists: map, filter, merge, scan, and time-aware ones such as debounce and throttle. Because each operator returns a new stream, they compose into a pipeline. The same vocabulary appears in ReactiveX libraries for JavaScript, Java, C#, Swift and Kotlin.

Dataflow: Wires Instead of Statements

Dataflow programming draws the same idea as a graph. Nodes are operations and edges carry data, and a node runs as soon as all its inputs are ready. Order comes from the data dependencies, so independent branches can run in parallel automatically. Visual tools (LabVIEW, Simulink, Node-RED) show the graph, and textual systems (spreadsheets, build tools, signals in UI frameworks) build it implicitly.

Push, Pull and Backpressure

  • Pull — a consumer asks for the next value, like iterating a list.
  • Push — a producer sends values when ready, like an event. Reactive streams are push-based.
  • Backpressure — when a producer is faster than its consumer, the stream must slow, buffer or drop values. Robust reactive systems make this explicit.

Representative Languages

These three show reactive ideas as a library, as a language architecture and as a visual language.

LanguageWhy study it
RxJS (ReactiveX)Observables and operators for asynchronous events in JavaScript, and the vocabulary shared by all ReactiveX libraries.
ElmA pure functional language for the browser built around Model-View-Update and one-way data flow.
LabVIEWVisual dataflow: programs are diagrams of nodes and wires, with parallelism for free.

The Trade-offs

Reactive code removes a lot of manual state handling, but the control flow becomes indirect: an update can ripple through many streams, and stack traces show operators, not your logic. Learn a small set of operators well, keep pipelines short, and name intermediate streams so they read as a description of the problem.