Reactive programming¶
Category: Async · Status: stub
One line: Describing a program as streams of values over time and the values derived from them, with changes propagating through automatically.
Also called: Rx, ReactiveX, Reactive Extensions, observables.
How it connects¶
flowchart LR
n_async_stream["Async stream"]
n_event_driven_programming["Event-driven programming"]
n_reactive_programming["Reactive programming"]
n_event_driven_programming ---|vs| n_reactive_programming
n_reactive_programming -->|uses| n_async_stream
classDef center stroke-width:3px
class n_reactive_programming center
classDef outside stroke-dasharray: 4 3
class n_async_stream,n_event_driven_programming outside
- Is built on: Async stream
- Often confused with: Event-driven programming
- See also: Dataflow programming, Publish-subscribe and broadcast
In each language¶
| Java | Flow ↗, the JDK's version of the reactive-streams interfaces |
| C# | IObservable<T> ↗, a provider for push-based notification |
| Kotlin | Flow ↗, including StateFlow, a SharedFlow that always holds the latest state value |
| Swift | Combine ↗: publishers expose values that change over time, and subscribers receive them |
| Elsewhere | ReactiveX ↗, whose Observable is the asynchronous, push counterpart of an Iterable |
Where to read more¶
- In the books: Async Rust, Maxwell Flitton, Caroline Morton — ch. 6, 'Reactive Programming'
- In the books: C++ Reactive Programming, Praseed Pai, Peter Abraham — ch. 1, 'Reactive Programming Model – Overview and History'
- In the books: Learning Concurrent Programming in Scala, Aleksandar Prokopec — ch. 6, 'Concurrent Programming with Reactive Extensions'
- In the books: Concurrency in .NET, Riccardo Terrell — ch. 6, 'Real-time event streams: functional reactive programming'
- In the books: Combine: Asynchronous Programming with Swift, Shai Mishali, Florent Pillet, Marin Todorov, Scott Gardner — ch. 1, 'Hello, Combine!'
- In the books: Kotlin Coroutines by Tutorials, Filip Babić, Nishant Srivastava — ch. 1, 'What Is Asynchronous Programming' → 'Using reactive extensions for background work'
- In the books: Concurrency in C# Cookbook, Stephen Cleary — ch. 1, 'Concurrency: An Overview' → 'Introduction to Reactive Programming (Rx)'
- In the books: Programming C# 12, Ian Griffiths — ch. 11, 'Rx: Reactive Extensions'
- Notes: Reactive Programming vs Asynchronous Programming ↗
- Reference: Wikipedia: Reactive programming ↗