Hacker News new | ask | show | jobs
by bugeats 2318 days ago
Turns out Conrad Irwin was right, but didn't take it far enough. Merge together "Events" and "Operations" into one thing, call "Models" just "state" and you've got Reactive Programming, which appears to have proven itself as the best known way to manage UI state complexity.
4 comments

Proven in what way? After almost 4 decades in this business, nothing is ever proven. For anything one person says is beyond discussion obvious, another person does something completely different, and gets the same benefits. Every generation comes up with new ways to do things, but nothing has even been clearly better to everyone all the time in all circumstances. You constantly have to evaluate everything that comes along, and see if it's better for you, your team, project, company or industry. Silver bullets are for vampires and the Lone Ranger.
It is "proven", not in a mathematical sense, nor a scientific sense, nor an engineering sense or even a legal sense. It is proven in a javascript sense.
React is just MVC turned inside out. The core principles still apply:

1. Any operation that changes the state the program is being used to manipulate should go to a single place and be fanned out to subscribers from there. 2. You want to be able to build compound views from simpler views and still treat them as the same kind of thing. 3. You want to be able to parameterize views over the behavior from interacting with them, e.g., you want to parameterize a button over what should happen when you press it, what its label should be, and if it is enabled.

You can do strict MVC in JavaScript just fine (https://github.com/madhadron/mvc_for_the_web). React has one major win that MVC can't give you: if you have lots of teams all putting things onto the same page, React controls the refresh loop so one team's code can't keep updating and destroy the performance of the whole page.

Reactive programming looks like a very good model for UIs, but I wouldn't claim anything is proven.

I am not sure we even got any implementation that is more convenient than event based UIs from a couple of decades ago. It does certainly looks like such implementations exist, they feel just within grasp, but there is a long way into "proven".

By "best" and "proven", you mean most popular way in the JS/TS world.