by interlocutor · 6y ago · 0 comments
In fact, it is easier to list UI frameworks that are not MVC-based: WPF, which is based on MVVM and React+ReactRouter+Redux, which is based on Flux.
MVVM was invented in order to support 2-way data binding. Inspired by WPF, many early JavaScript frameworks supported 2-way data binding. These days 2-way data binding is widely acknowledged as a poor design as it makes it hard to keep track of how data is flowing through your application. For more on that see [1].
React was originally introduced as the "V in MVC" [2]. Since then it drifted away from MVC in an ad-hoc manner. In part this is because of ReactRouter, which made router a view component (!), and in part this is because of Flux/Redux. The facebook engineer who came up with Flux famously declared that MVC doesn't scale (!!). This assertion was widely challenged, and later she acknowledged that it is bidirectional data flow that doesn't scale [3]. She had assumed that MVC automatically implies 2-way data binding. Redux, an implementation of the Flux architecture then became popular, and became closely associated to React, so much so that many developers believe using React implies using Redux. This is unfortunate because Redux requires tons of boilerplate ("so much throat clearing", as one developer put it), which MVC does not require.
[1] https://changelog.com/131/ (starting around 0:43)
[2] https://github.com/facebook/react/tree/015833e5942ce55cf31ae...
It's funny how the software industry can simultaneously produce games with hundreds of textured 3D models flying around the screen at 60 fps, but if I want to load a big data table of nothing but text in a web browser, the fans start spinning and the scrollbar locks up.
If all of those are MVC, does MVC even mean anything?
What are the core commonalities across all those development frameworks that make them "MVC"?
The Views accept data and generate a UI of some kind. They have no idea where the data comes from, or what their requests actually do.
The Controller knows about both the Model and the View. It maps request from the View to operations in the Model, and then uses data from the Model to update the View.
M <= C => V
That is the broad structure behind how all those things works. They aren't all the same, but that's not the point of a design pattern.
Not _required_. There's both "inherent" and "incidental" complexity around Redux [0]. We've created our new Redux Toolkit package [1] to specifically eliminate the "incidental" complexity and simplify common Redux usage patterns. It includes utilities to simplify several common Redux use cases, including store setup, defining reducers, immutable update logic, and even creating entire "slices" of state at once.
We also just released the official Redux template for Create-React-App [2] to help speed up the process of setting up a new app.
[0] https://blog.isquaredsoftware.com/2019/10/redux-starter-kit-...
[1] https://redux-toolkit.js.org
[2] https://github.com/reduxjs/cra-template-redux/releases/tag/v...
https://docs.djangoproject.com/en/3.0/faq/general/#django-ap...