25 ms·
which begs the question what do you need MVC for, what is it if not a way of structuring code? If you can just structure your code by splitting to multiple file
by nsonha 5y ago
which begs the question what do you need MVC for, what is it if not a way of structuring code? If you can just structure your code by splitting to multiple files abitrarily, regardless of MVC
- gurkendoktor 5y agoI don't think splitting up the controller part into multiple classes is a break from MVC. Nobody would demand that the view or model layer consists of a single class per screen, why should the controller layer follow this rule? I actually agree with what you said in some way. Projects should start with whatever is the most boring, straightforward architecture possible, and then evolve it organically. But for UIKit projects, that boring foundation is to vaguely follow Apple's idea of MVC, at least so that JSON parsing and font size adjustments don't happen directly in an IBAction.
- nsonha 5y agoback when I was still doing Android, there was this trend in Android to throw away Google MVC and just have everything as view (and none of fragment, activity and all that crap). The rest of your code you just slice up in ways that makes sense. You platform-dependent logic just reuses the same activity to access the junk google provides.
- ptx 5y agoAs I understand it, MVC is just how Smalltalk built its GUI toolkit: for each widget, the view did the rendering, the controller responded to user events and the model held the data. All the GUI toolkits that followed combined the view with the controller, which is why MVC seems to make no sense. As for structuring your code, someone (I don't remember who) offered the suggestion that out of all the parts that the framework gives you, your application logic doesn't belong in any of them.
- jmull 5y agoYep. MVC is a UI pattern. How the UI displays application state and updates application state based on user interaction. Everything else is outside MVC. Apparently some people don't understand this and stuff their application logic into MVC controllers.
- deleted 5y ago[deleted]