Skip to content

ReactFX vs ReactiveX

Geoff edited this page Jul 29, 2016 · 3 revisions

ReactiveX (Reactive Extensions) is a "framework for asynchronous programming with observable streams." Implementations in multiple languages exist, such as RxJava (Reactive Extensions for the JVM).

Synchronous vs Asynchronous

The key difference from ReactiveX is that event propagation in ReactFX is (almost always) synchronous.

This is consistent with change propagation in JavaFX bindings.

Synchronous event propagation allows for more coordination between event streams, which reduces the number of glitches (temporary inconsistencies in observable state). With ReactiveX, one has to settle for eventual consistency, which in the context of UI programming would frequently result in UI glitches.

The only exceptions to synchronous event propagation are asynchronous operations like await, successionEnds or threadBridge.

Tailored for JavaFX and other single-threaded models

Event propagation in ReactFX stays within one thread (except, obviously, for threadBridge). This means that when an event source produces events on one thread, you don't have to worry that they will be delivered on a different thread. In the context of JavaFX, this means that you don't have to wrap UI manipulating actions in Platform.runLater if the events leading to the action originated from the JavaFX application thread.

ReactFX contains a bunch of JavaFX specific adapters and other utilities, such as JavaFX-based timers.