Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The Model in MVC

I am just starting on ASP.NET MVC trying to understand the philosophy first. I think I am pretty clear on the roles played by the controller and the view but I am a little confused on the model part. Some sources say its the domain model, some say its the data model, some say its the objects that are bound to the view.

IMHO these are very different things. So please can someone clear this up once and for all?

like image 296
Ali Kazmi Avatar asked Apr 03 '09 19:04

Ali Kazmi


1 Answers

The model is "the domain-specific representation of the information on which the application operates". It's not just the data model, as that's a lower level than the MVC pattern thinks about, but (for example) it's the classes that encapsulate the data, and let you perform processing on them.

Scott Guthrie from MS uses this definition in his announcement:

"Models" in a MVC based application are the components of the application that are responsible for maintaining state. Often this state is persisted inside a database (for example: we might have a Product class that is used to represent order data from the Products table inside SQL).

Further reading:

  • the MVC Wikipedia article
  • the MVC pattern on C2
like image 107
crb Avatar answered Oct 13 '22 01:10

crb