liveBook · Manning

Reactive programming

As explained in Functional Design and Architecture: Examples in Haskell

Reactive programming is a programming technique for expressing computations that respond to continuously arriving events or changing data.

Reactive programming keeps computations alive: instead of calculating one result from fixed inputs, it feeds formulas with changing environmental data so they continually produce updated results. This suits systems whose safety or behavior depends on responding to new information. section 8.1

Spaceflight formulas

A rocket’s fuel calculation can be performed once, but a spacecraft contains interconnected systems whose conditions change during flight. Reactive programming provides an environment where those formulas respond to incoming data rather than relying on complete precomputation. section 8.1

Reactive applications can be organized through several designs:

  • Use actors to organize stateful applications, while recognizing that safe and reliable actor interactions carry a cost. section 8.3
  • Use reactive streams or custom event-driven models to structure data arriving over time. section 8.1
  • Treat communication protocols as contracts between actors; larger concurrent models may outgrow MVars and benefit from STM or message queues. section 8.3

How Functional Design and Architecture: Examples in Haskell covers it

How deep it goes
Defines the motivating principle and surveys actors, streams, event models, protocols, MVars, STM, and message queues without detailed implementation.
Examples
Uses spacecraft motion, fuel, and interconnected-system formulas as the central domain example.
What you can do after
Evaluate reactive designs by comparing actors, streams, event models, MVars, STM, and message queues.
How it connects
Links reactive programming with actor model, reactive streams, event-driven programming, concurrency, software transactional memory, and message queues.

Also explained in

Compare how 6 books explain reactive programming →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Functional Design and Architecture: Examples in Haskell. The section links point to the parts of the book it draws on.