4 ms·
Takes me back to the time when MVC zealots absolutely lost heir shit when React came out. React obliterated their world view and they simply could not cope. I
by Marazan 4y ago
Takes me back to the time when MVC zealots absolutely lost heir shit when React came out.
React obliterated their world view and they simply could not cope.
I am using hyperbolic language but the "Anti-React" 'backlash' was truly mind boggling.
- My104thaccount 4y ago
- vbezhenar 4y agoI'm not computer theorist. But to me React seems like a perfect implementation of MVC. Model is state. View is virtual-dom chunks. And controller is an actual function implementation which maps state to view.
- deleted 4y ago[deleted]
- elanning 4y agoThis is typically a good way to organize React projects, in my experience. A few top-level components which hold state with a useReducer and have a few functions to make backend calls, as needed. You could consider the reducer the model and the top-level component the controller. All components that sit below the top-level are pure view components. Props in, view out. They at most hold a minor amount of UI state. They don’t make API calls or update state themselves, that must be done with a callback to the top-level component. This makes testing simple as you can test the reducer without rendering any UI. The pure view components are also easy to test. Then a few end to end tests to tie everything together. https://www.reactguide.dev/#mc-v-trees https://www.reactguide.dev/#mc-v-trees Has more info on how to scale the pattern for larger apps.
- phailhaus 4y agoReact is an implementation of the Flux architecture model, which is different from MVC. [1] [1] http://fluxxor.com/what-is-flux.html http://fluxxor.com/what-is-flux.html
- mpweiher 4y agoInterestingly, most of what they claim about MVC is false, and the problems they see with what they call MVC are mostly solved by following actual MVC, others by specific implementations of MVC. I had only seen these misunderstandings in talks (particularly the "cascading", which true MVC absolutely prevents), which are difficult to refer to, so thanks for the link! As I wrote elsewhere[1] : "having to say "the problems of MVC are solved by MVC" is less than ideal, because, well, you sound a bit like a lunatic." [1] https://blog.metaobject.com/2017/03/concept-shadowing-and-capture-in-mvc.html https://blog.metaobject.com/2017/03/concept-shadowing-and-ca...
- wruza 4y agoThis is what bugs me most about these talks. I don’t mind when some guys do something their way, unique or not. But when they spread fucking lies about prior tech to very large auditories, it makes me think about either a conspiracy or their complete lack of competence in this area.
- Marazan 4y agoI've yet to find two proponents of "true" MVC who can agree what goes in the model and what goes in the controller.
- mpweiher 4y ago1. https://folk.universitetetioslo.no/trygver/themes/mvc/mvc-index.html https://folk.universitetetioslo.no/trygver/themes/mvc/mvc-in... 2. Controllers, like views and model(s) are roles, not components. These roles can be filled by the same objects. 3. So people not agreeing where things go is perfectly compatible with MVC, and thinking that's a problem is a symptom of not understanding MVC. 4. I personally try to put as much as possible (and a bit more) into the model. Hexagonal for the win! Naked objects are also pretty nice, though I tend not to be quite that radical. ¯\_(ツ)_/¯
- Marazan 4y ago
- FinalBriefing 4y agoYes, and no. Implementing MVC patterns in React requires developers to architect it that way.
- FinalBriefing 4y agoI'm still one of those people. Separation of concerns is a big concern for me. In my experience with React, it's a lot harder to keep things separated, and developers who I've worked with who have more React experience aren't always up on the concept.
- LAC-Tech 4y agoMVC is something I've looked up dozens of times in my career, and always forget what it is. Still consider myself anti-react. It's a leaky abstraction.
- Existenceblinks 4y agoI'm an anti-react by truth, not bias. I'm fine with me-too approach when a company adopts React. But if your company has resources and still pick React, the knowledge and experience of the decision maker is questionable. This is not coping! It is speaking truth to deniers.
- mcluck 4y agoI worked on MVC applications for years. I have now worked on React apps for years. The UI-as-a-function model is an absolute godsend.
- Existenceblinks 4y agoIt's not about ui = f(x) though, it's about React. There are a lot of `ui = f(x)` that are more efficient and lightweight.