DEV Community

Discussion on: What the hell is Reactive Programming anyway?

Collapse
 
hulkaroyjouraboeva profile image
Hulkaroy Jouraboeva • Edited

Hi Ryan, could you elaborate on what you meant by:

Asynchronous? Not necessarily. Streams? Not always.

Have no idea about the streams statement, but isn't reactivity in general always about responding to asynchronous events, and updating data based on that async event?

Collapse
 
ryansolid profile image
Ryan Carniato This is Learning

Yes but some reactive systems are async in nature and others are not. Like RxJS/Observable streams view everything a sequence of values over time that go through transforms. An Observable is not defined by its value but rather is an event emitter, something that passes values through. They even have a notion of being done or completed.

Whereas like the Signals you find in Solid or Vue's Ref are a different sort of thing. They are the value. Their value might change over time but their identity is associated with that value and it is always accessible. There is always a current value. These systems aren't really concerned with time and only with everything being perfectly in sync, glitch-free. Ie.. when you update this Signal everything downstream immediately reflects that. These systems propagate change synchronously generally. They are never "done" because they aren't a sequence, they are the thing.

To be fair RxJS has a concept similar called BehaviorSubject. But I just wanted to point out that the Rx definition doesn't cover the whole landscape.