Reactive Programming and JavaFX - Article in german JavaMagazin

javajavafx

I've written an article for the german JavaMagazin 7.15 with the topic "Reactive Programming mit JavaFX" (you can find it here online: jaxenter.de).

In the article I'm introducing the reactive programming paradigm from the perspective of a UI developer. Reactive Programming is technique to escape from the so called "callback hell". Instead of reacting to user events with callbacks (i.e. side effects on a global state) you define dependencies between time-varing values that will be updated automatically by the programming environment when changes or events are happening.

With its properties and data-binding API, JavaFX already has a good base for reactive programming.

One point I wanted to highlight in the article is the fact that you don't necessarily need a functional programming language to do "Reactive Programming". Of course the original work and research in the field of reactive programming was done with functional languages but it's possible with non-functional languages like Java too (of course the syntax is far more inconvenient but thats a fact that apparently every java developer has resigned to ;-)). A relatively simple abstraction over the Observer design pattern is all you need, like it is done in the internal implementation of the JavaFX properties and databindings.

To make the programming easier there are also libraries available that can help to write JavaFX application in a reactive programming way. The first library I'm introducing in the article is my own Advanced-Bindings project that can be used for more complex bindings.

After that I'm using the really cool ReactFX library for composition of event streams. At the end I'm presenting the library RxJava which is obviously the most famous of the stated libs. In the article I'm showing how you can integrate a RxJava based service in a JavaFX application.