I don't know what it is lately, but I find myself bumping into design patterns every which way I turn. I recently reviewed Christopher Alexander's A Pattern Language, and here I am writing about an explicit design pattern called MVC (for Model-View-Controller).
The MVC design pattern is widely used in applications that need to maintain multiple views of the same data sets. The fundamental principle at work here is functional separation. Models maintain the actual data; views provide logical windows into that data and control what users can see and interact with; and controllers handle events that might affect either a model or a particular view.
This structure permits multiple views and multiple controllers to interface with a single model, and it permits new views and controllers to be introduced at will without imposing any changes to model designs. As a paragon of uncoupled designs, this one is a real peach! (For more information and some nice diagrams, check out the description of MVC at enode.com).
Given this background, Microsoft's MVC offering may begin to earn its status as a "cool tool" for ASP.NET. It provides scaffolding and support building MVC applications using the ASP.NET framework that provides an interesting and (to many developers) appealing alternative to ASP.NET Web Forms. This tool affords numerous benefits, including:
- Clear separation of tasks and data views
- Support for test-driven development approaches
- User-intelligible URLs (Microsoft calls them "intuitive," but I think they're pushing their luck)
The ASP.NET MVC framework is currently at the release candidate stage, which means it's still in what can only be called a "late beta" mode. Nevertheless, this capability is reasonably mature and surprisingly capable. Check out Microsoft's ASP.NET MVC home page, where you'll find tutorials, videos, a design gallery and some interesting sample applications, as well as the downloads you'll need to start putting this interesting and powerful design pattern to work. Enjoy!
Ed Tittel is a full-time writer and trainer whose interests include XML and development topics, along with IT certification and information security topics. Email Ed at firstname.lastname@example.org with comments, questions or suggested topics or tools to review.