Tuesday, December 02, 2008

MVC Demystified

I posted yesterday about application frameworks causing vertigo. In reading through this article by Malcolm Tredinnick I breathed a sigh of relief. Things made sense again.

I genuinely feel that people are locking their thinking in, and causing unnecessary confusion, by getting hung up on "MVC practices". When, as I hope I've shown and linked to, the problem space is much more subtle than that and multiple solutions exist. Focus on the problem you are trying to solve. Keep in mind that there are many similar, but different solutions and think about the Django mapping example I did in the previous section. Hopefully you can see that it's ridiculously constraining (not to mention, simply incorrect) to assign labels to broad components in a framework when they work at a much finer-grained level.


Malcolm links to ModelViewController at WardsWiki which provides excellent information on these usefult echniques. In a recent interview, a developer asked me to define MVC design. I put together the traditional explanation, and I thought the quote on the WW article summed it up nicely:
The model is the data, the view is the window on the screen, and the controller is the glue between the two. -- ConnellyBarnes