In a post on Slashdot, Val Huber, CTO at Espresso Logic in Santa Clara, Calif., did a comparison of Reactive Programming to Java with Hibernate and MySQL triggers using a real-life business example. In the test, Reactive Programming surpassed conventional procedural programming models with a faster time to market, reduced maintenance, better quality and a higher level of transparency.
Using a simple scenario involving customers with purchase orders consisting of line items, Huber compared what it takes to implement business logic using the different approaches. The set of requirements was “small and familiar, yet sufficiently complex to warrant extrapolation to larger systems.”
When code was written, the logic in Java/Hibernate required 500 lines (see code here) and with MySQL triggers, it took 200 lines (see code here). But it required just five lines of code with Reactive Programming, indicating a significant advantage in the construction of backend database logic. As it turns out, Reactive Programming has a similarity to a spreadsheet, since it automates the define, watch and react process. A big plus for Reactive comes from “chaining,” where the result of one Reactive expression is used by another. Just like a spreadsheet, chaining expresses complex logic in a very simple way.
Reactive Programming sums up logic expressions into relevant columns. The end result is that your logic is automatically invoked on any changes to those columns, and it doesn’t matter what the use case might be.