views:

317

answers:

3

The more I work with and read about ASP.NET MVC, it seems as though the "M" or Model is a topic that seems to cause a significant amount of confusion.

Should the MVC framework really be renamed to Adapter View Controller? Where the Adapter is responsible for delivering data models to the view?

+2  A: 

The term "Model" leads to a lot of confusion when it comes to Domain Models and MVC. The reality is that if you are at all focused on developing Domain Models, then that's what the Model in MVC refers to. Concepts like ViewModels and Presenters are, as you say, adapters. I like to refer to those objects with terms like "ModelAdapter", "ViewAdapter", or "EditAdapter."

Domain Models are intended to be behavior centric and are not themselves suited to UI activities like binding. That's precisely what ModelAdapters (ViewModels) are for.

jlembke
+4  A: 

I don't think it really matters what the heck the name is. In most well developed applications the data/model/whatever layer will be its own standalone assembly with ViewModels (what you are labeling as adapters appropriately) built in the application to support the objects in this assembly. but it doesn't have to be for simple applications, you can have this all live within the Model in an MVC project. The term 'Model' I think is a generic enough term to give flexibility to this meaning.

It is probably named MVC because that is a buzzword and buzzwords are good for marketing and management.

Jon Erickson
buzzwords used improperly create mass confusion...
RSolberg
A: 

The "Model" in MVC really represents the "model" which is responsible for acting as a data container for carrying data between the underlying structure and the view. Delivering the model to the view is the responsibility of the controller. Actually, this is a controller's main responsibility.

This is not a new concept that is introduced by ASP.NET MVC framework. The framework is only an implementation of the well known mvc pattern and very accurately named since it follows the exact model-view-controller pattern.

There are also MVP, MVVM, and DMVVM patterns which you can consider as other alternatives for the same problem. None of them ignores the simple model since a very simple data holding model is what should be followed.

Serhat Özgel
The model is more than a data container in most applications. It is the home of your business rules and behavior. That's why it isn't suited to UI binding. The controller shouldn't deliver the model, but an adapted "ViewModel" or presenter.
jlembke
:)In my opinion..
jlembke
DMVMV not DMMVM
Firoso
I corrected it as DMVVM: Data Model - View - ViewModel
Serhat Özgel
jlembeke: It does not have to be that way and model should not hold business rules. A model, that is responsible of both holding data and business rules would violate single responsibility principle.
Serhat Özgel
are you saying that business rules are in the controller or view?
Jon Erickson
It doesn't have to be that way, but how can you possibly say that a model "should not hold business rules"? That in no way violates SRP. You should do some Domain Driven Design reading.
jlembke
Jon Erickson: Of course I do not. Those go to their own separate class.jlembke: I'll do, thanks.
Serhat Özgel