▲ | jerf 4 days ago | |||||||||||||
One of the other markers of "true MVC" I look for is that you ought to have pervasive mixing and matching of the pieces. It is common for models to see some reuse in multiple "views" and "controllers", but if all or almost all of your controllers match up to precisely one view, then you're burning design budget on a distinction that is buying you nothing. If you've got strictly one-to-one-to-one matches for each model, view, and controller, then you're just setting your design budget on fire. Another major aspect of the original "true" MVC is multiple simultaneous views on to the same model, e.g., a CAD program with two completely live views on the same object, instantly reflecting changes made in one view in the other. In this case MVC is less "good idea" than "table stakes". I agree that MVC has fuzzed out into a useless term, but if the original is to be recovered and turned into something useful, the key is not to focus on the solution so much as the problem. Are you writing something like a CAD program with rich simultaneous editing? Then you probably have MVC whether you like it or realize it or not. The farther you get from that, the less you probably have it... and most supposed uses of it I see are pretty far from that. | ||||||||||||||
▲ | catlifeonmars 4 days ago | parent | next [-] | |||||||||||||
> if all or almost all of your controllers match up to precisely one view, then you're burning design budget on a distinction that is buying you nothing. This is a really insightful way to frame it. | ||||||||||||||
▲ | RossBencina 4 days ago | parent | prev | next [-] | |||||||||||||
> if all or almost all of your controllers match up to precisely one view, then you're burning design budget on a distinction that is buying you nothing. Could you give an example? I've never understood how one could possibly reuse a Controller independently of a View. At a minimum any kind of mouse-based direct manipulation requires the Controller having access to the displayed geometry in order to implement hit testing. E.g. how is a Controller supposed to update the selection range in a text editor without screen-coordinate character extent information from the view, or a drawing editor Controller accessing scene graph geometry for object selection, control handle manipulation, etc. | ||||||||||||||
| ||||||||||||||
▲ | kqr 4 days ago | parent | prev | next [-] | |||||||||||||
Oooh. Now I get it. I've been dismissive of MVC for nearly as long as I've known it but I realise I've only seen the bad versions. What you describe as correct sounds much more sensible. | ||||||||||||||
▲ | skydhash 4 days ago | parent | prev [-] | |||||||||||||
> If you've got strictly one-to-one-to-one matches for each model, view, and controller, then you're just setting your design budget on fire. That's sensible. But it's generally useful to split your core state from your presentation, and then you'll find strands of logic that belongs to neither, generally glue code, but some can be useful enough to warrant a module of their own. Also your core state can be alien from the view itself (think a game data (invisible walls, sound objects) and the actual rendering). Maybe this architecture is not MVC, but MVC can be a first stab for a quick and dirty separation. Then once a cleaner separation can be done by isolating specific modules (in layers, graph, whatever) | ||||||||||||||
|