re: Top JavaScript Frameworks For 2019 VIEW POST

FULL DISCUSSION
 

In regards to Angular, you wrote, "Supports two-way data binding which greatly minimizes the risk of errors."

Two way data binding can actually cause more errors and can also make it a lot more difficult to understand how the data flows through.

This is one of the reasons why React implemented one way data binding and other frameworks like Vue followed suit. See vuejs.org/v2/guide/components-prop... and reactjs.org/docs/thinking-in-react...

 

Two-way data binding is just a shorthand for the double one-way data binding you do in React.

  • From view-model to view: either dirty-check, proxy or wrap the property in a getter/setter.
  • From view to view-model: listen for specific DOM events (most notably, change)

In React you need to manage the synchronization yourself. A framework can do this properly for you (I'll name Aurelia since that's what I use and work on) without sacrificing on control or flexibility.
A framework supporting two-way binding out of the box will typically have a more robust mechanism than the variant you'll write by hand, which everyone might do a little differently.

I would therefore say that two-way data binding does indeed minimize the risk of errors, granted it is done well. It also reduces boilerplate (resulting in a smaller and easier to maintain app) and tends to improve performance (Aurelia outperforms React by over a factor of 3 in binding/observation, although that has more to do with the use of observers instead of a VDOM)

 

Maybe i didn't pen my thoughts concerning 2-way data-binding more clearly. What i meant was that 2-way data binding offers an incredibly high degree of assurance that the model and the controller are in sync, because during every cycle, they are checked against each other. 2-way data binding is still practical in small applications where absolute consistency between the view and model is critical. However this has an obvious downside that it is much more complex and quite slow compared to one way data binding. One-way Data Binding is expectedly much faster, much simpler and easier to comprehend but also has less assurance that the view and model are the same. Things might not change in the model and wrong data may continue to exist. But Speed, performance and simplicity are the dominant factors which is why all modern frameworks that came after angular like React and Vue dumped 2WDB for this very reason. But for some applications 2wDB is still practical that's why it wasn't completely deprecated in angular 2.

code of conduct - report abuse