Hacker News new | ask | show | jobs
by brilliantcode 3408 days ago
but I was told MVC was sooo 2006, multi way data binding will make you suicidal, unidirectional flow of data is king and redux is what the industry should now use.

Genuinely curious how people will react to this because it's a contradiction, we were always told React & Redux go well together but I'm always holding out the last bit of skepticism.

3 comments

But with crizmas-mvc there's no multi way data binding, or at least not from the view to the model. The controller can set some state on itself as a reaction to UI events, but only to provide feedback to the UI (for instance you may want to disable a menu when a button is clicked). The domain data is always in the model and the view is not allowed to touch it, but only to render it.
It's a big world, and there's room for more than one way to write software. Dan Abramov himself wrote the counter-argument to Redux:

https://medium.com/@dan_abramov/you-might-not-need-redux-be4...

In short, do what's right for your project.

>unidirectional flow of data is king

I have heard this in passing and haven't had time to dig into it. What's this argument, exactly?

In my experience, once your application grows large, if there is a clear path or direction of data flow you tend do have less bugs. If your application has N components and you don't have a single data "bus" you have N * N possible interfaces between the various components hence N * N opportunities to introduce bugs, while if you have a single data bus, you only have N interfaces and less opportunities to introduce bugs as a consequence.

Obviously in practice not all components will interface with every other component, but there is still a lot of complexity added by arbitrary communication between the various components.