5 ms·
Nearly all UI frameworks use MVC. That includes iOS, ASP.NET Core, JSP and JSF (both Java), Ruby on Rails, and Django (Python). In fact, it is easier to list U
by interlocutor 7y ago
Nearly all UI frameworks use MVC. That includes iOS, ASP.NET Core, JSP and JSF (both Java), Ruby on Rails, and Django (Python).
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/ https://changelog.com/131/ (starting around 0:43)
[2] https://github.com/facebook/react/tree/015833e5942ce55cf31aefd0a5c2be8a65ec2daa https://github.com/facebook/react/tree/015833e5942ce55cf31ae...
[3] https://www.infoq.com/news/2014/05/facebook-mvc-flux/ https://www.infoq.com/news/2014/05/facebook-mvc-flux/
- acemarke 7y ago> Redux requires tons of boilerplate 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.0/#dealing-with-complexity https://blog.isquaredsoftware.com/2019/10/redux-starter-kit-... [1] https://redux-toolkit.js.org https://redux-toolkit.js.org [2] https://github.com/reduxjs/cra-template-redux/releases/tag/v1.0.0 https://github.com/reduxjs/cra-template-redux/releases/tag/v...
- jimbokun 7y ago"That includes iOS, ASP.NET Core, JSP and JSF (both Java), Ruby on Rails, and Django (Python)." 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"?
- ncphillips 7y agoThe Models are all the code that define your business logic. They have no idea how they get represented in the UI, and they have no idea what calls their operations. 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.
- Nasrudith 7y agoSpeaking from experience I wish WPF was based on MVVM, MVC, or even a consistent usage. What it is really based upon is hypocrisy and piles of footguns.
- tveita 7y agoDjango doesn't consider itself to use MVC. https://docs.djangoproject.com/en/3.0/faq/general/#django-appears-to-be-a-mvc-framework-but-you-call-the-controller-the-view-and-the-view-the-template-how-come-you-don-t-use-the-standard-names https://docs.djangoproject.com/en/3.0/faq/general/#django-ap...
- zelly 7y agoThere's a third option, an Entity-Component System (ECS). It is common in games but scales well to UIs. Everything in your UI is stored in a flat structure. Instead of putting a button in a widget 5 layers of nesting deep, you put them all in an Button[] array, and other entities reference a Button by its index. Objects are laid out more like a normalized database table than an OOP tree. Your UI thread is an event loop that iterates over and mutates the widgets. This is extremely fast, cache friendly, easy to reason about, and can scale to the tens of gigabytes (AAA games). 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.