MVC?

Published 10 December 06 09:19 AM | adrian

One of the most widely used pattern in software design is MVC, short from Model-View-Controller. So what kind of thing is it exactly?

MVC is an architectural pattern, defining how the application will take form. This is a higher level of abstraction than design patterns.

MVC separates the codes into Model, View, and Controller (hence the name). Model contains code about a specific object, from data access to domain logic for the specific object. View contains code for presenting or interacting with useres. Controller is the connector between Model and View, processing changes to Model and feed it to the View.

MVC benefits users when they have a medium-sized application requiring high level of customization/maintainability. For smaller, more static applications, it's quite an overkill to separate the objects, although it is always a good practice to do that (remember the chant "low coupling high cohesion"). For larger, enterprisey applications, sometimes the separation to MVC just doesn't scale, especially when there is a business process between models, controllers, or views. Layered architecture is more flexible when it comes to orchestration between a lot of object.

The other problem with MVC is, it's outdated. A lot have happened between the first MVC concept in 1980s. For example, in WinForms, the View and Controller portion is combined in one place. Controller routes user interaction to the Model, and View reacts to changes within the Model using Observer Pattern (a.k.a. Event Handling).

So, MVC is a good starting point to understand how things (should) work between user and the database, but to make it functional and useful, you should add a lot of other things in between.

Share this post: | | | |
Filed under:

Comments

# csharpindonesia said on December 11, 2006 08:57 AM:

So, do you have any good url that exposes MVC to the newbies in a simple and friendly language?

# Andry said on December 11, 2006 12:34 PM:

#csharpindonesia Castle MonoRails is a good starting point to play around with MVC within ASP.NET. (However, personally I love Struts/Webworks and RoR better though).