MVC Obscures the Mechanics of the Web

I dug up some links on the mismatch between MVC and the Web:

It's hard to explain in simple terms why MVC is such a poor pattern for web development. I don't claim any particular success in converting people away from the lure of GUI patterns but in my experience the hardest task is resetting people's internal model of a web "application". MVC works pretty well in the traditional GUI where you might have an item (e.g. a document) that you wrap with a model and expose with different views (as an icon and label in a treeview, a larger icon in a window, an editable word processing view, a print preview with different font metrics, a thumbnail presented when the mouse hovers over the icon). You add a controller to enable multiple interations in various views (selecting with the mouse, selecting by using tab key, activating an icon by double-clicking, activating an icon by pressing enter, modifying content by typing on the keyboard, copying and pasting content of the document, copying and pasting the document itself as an icon, dragging, dropping). Yes, in that complex world MVC can help to simplify the programming.

But the Web isn't so complex. You have resources, which could be models in MVC. But you only have a handful of interactions and they're all the same for every resource. You also have only a single way to view an item. You could possibly stretch the notion of representation to encompass multiple views but there's nothing like the huge presentational differences that you get in a desktop GUI - just minor variations of markup language. MVC just obscures the mechanics of the Web, forcing the developer to write code that isn't necessary and layer on more complexity when the mechanics start leaking through. Once you break your infatuation with MVC you find yourself writing much simpler code that mirrors the operations that drive the Web, and you actually start understanding a bit more about HTTP, the protocol that most frameworks try to pretend doesn't exist.

Permalink: http://blog.iandavis.com/2007/09/mvc-obscures-the-mechanics-of-the-web/

Other posts tagged as technology, web

Earlier Posts