Reactive vs Event-Driven Architecture
Two paradigms for systems that respond to change — discrete events with imperative handlers, or continuous streams with declarative pipelines. Both valid, both powerful, solving different classes of problems. A cross-domain guide.
| Doc no. | Type | Date | Category | References |
|---|---|---|---|---|
| AN-002 | Application Note | April 7, 2026 | Engineering | SHEET 07 |
Modern systems respond to change — user actions, sensor updates, device state, audio streams, network packets, database events, and more. Two major paradigms exist:
- Event-Driven Architecture (EDA) — discrete events, imperative handlers
- Reactive Programming (RP) — continuous streams, declarative pipelines
Both are valid. Both are powerful. But they solve different classes of problems. This guide explains when to use each, with examples across diverse domains.
Event-Driven Architecture
"Something happened — run this handler."
EDA is the classic model used in UI frameworks, PLCs and industrial automation, hardware interrupts, state machines, device notifications, and game input systems.
Characteristics: discrete events, imperative handlers, no built-in composition, no notion of time or streams. Simple, predictable, low overhead.
When to Use Event-Driven
State machines — use EDA when transitions are discrete:
Idle → Heating → Holding → Cooling → Idle
Events like TemperatureReached, DoorOpened, EmergencyStop, TimerExpired — each event triggers a single transition.
Industrial machine control — PLC logic is inherently event-driven: sensor triggered → stop conveyor; limit switch hit → reverse motor; operator pressed Start → energize outputs. These are instantaneous, deterministic reactions.
Audio systems — user toggles mute, drags a volume slider, a device is added or removed, a session is created or expires. Discrete actions.
Graphics — window resized, mouse clicked, key pressed, shader reloaded. Not continuous streams.
Automation, databases, networking, games, UI — file created, row inserted, trigger fired, packet received, connection closed, player pressed jump, button clicked. Discrete events, all of them.
Reactive Programming
"Treat events as streams of data over time."
Reactive programming is designed for continuous data, high-frequency updates, composition of multiple event sources, and time-based operators — throttle, debounce, buffer.
When to Use Reactive
State machines — when inputs are continuous streams and you need to derive events from time-based patterns:
- Detect "no input for 5 seconds" → Timeout event
- Detect "three errors within 10 seconds" → Fault state
- Monitor analog sensor streams and trigger thresholds
Reactive transforms streams into events.
Industrial machine control — high-frequency sensor sampling, vibration analysis, temperature trending, predictive maintenance, combining multiple sensor streams:
Combine(LoadCellStream, MotorCurrentStream)
→ Detect jam conditions
Audio systems — reactive programming shines here: volume-change streams, session streams, FFT sample streams, device switching. Audio is inherently continuous.
Graphics — animation timelines, frame update streams, reactive camera movement, mouse smoothing:
MouseMoveStream.Throttle(16ms) → Smooth camera rotation
Automation and telemetry — monitoring logs, watching file systems, throttling noisy event sources.
Databases — change streams (CDC), real-time analytics, event sourcing:
OrdersStream.Buffer(1 second) → Batch process
Networking — packet streams, WebSocket streams, rate limiting, backpressure:
IncomingPackets.Throttle(5ms).Subscribe(ProcessPacket)
Games and UI — reactive AI behavior, input smoothing, live search, reactive forms:
PlayerVelocityStream
.Select(Speed → Speed > 10)
.DistinctUntilChanged()
→ Trigger "Run" animation
Decision Matrix
| Scenario | Event-Driven | Reactive |
|---|---|---|
| Button clicked | ✔ | |
| Motor limit switch triggered | ✔ | |
| FFT sample processing | ✔ | |
| Database row inserted | ✔ | |
| Database change stream | ✔ | |
| Packet received | ✔ | |
| Packet rate smoothing | ✔ | |
| State machine transition | ✔ | |
| State machine timeout detection | ✔ | |
| UI slider moved | ✔ | |
| UI slider smoothing | ✔ | |
| Sensor interrupt fired | ✔ | |
| Sensor threshold trending | ✔ |
Summary
Use Event-Driven when: the event is discrete, the reaction is immediate, the logic is imperative, the frequency is low, the system is deterministic — state machines and control logic.
Use Reactive when: the data is continuous, you need composition, you need throttling and debouncing, you need to merge or transform streams — audio, graphics, telemetry, and sensors.
Use both together for real systems. Event-driven for actions. Reactive for flows.
A panorama sweep that assumed the world would hold still. It did not. The algorithm made exactly one bad assumption and then committed to it, with total confidence, all the way across the frame.
Which is the whole argument for stating a tolerance: every measurement carries one, whether or not anybody wrote it down.
SCALE: NONENOT TO BE USED FOR FABRICATION