what is Model in MVC ?

image_pdfimage_print

MVC is

  • Data (Model)
  • An interface to view and modify the data (View)
  • Operations that can be performed on the data (Controller)

 

M + V = C>>    Controller is  preparing Model then creating  View.

In the Center  there is a Controller

 

For Simple  >   Model = ‘ DATAS’    

* The model is the data, and does nothing else.

Models (All of models in project ) does NOT depend on the controller or the view.

Controller Calling Model then  pushing it  to  View.    Controller is handling. But for the preparing the datas,  controller does not effect  how the model creating data sets, structs, objects.

Controller says model to that: Prepare user_table[array] ,

After pushing this  object  to  View,  View is using this table,

 

what is Controller ?

Such as button clicks. The controller depends on the view and the model.

Events.

The controller and the view are the same object. WHY >    You can return   a string   as a page   return  “”

 

 What is the Advantage of model ?

Unnecessary complexity is the devil of software development.

Time loss for companies.  .  Complexity leads to software that is buggy, and expensive to maintain.

The easiest way to make code overly complex is to put dependencies everywhere.

* You can use model, Directly  Copy paste inside of another  Project.  You can Call the Model from  different  Views, or Controllers.
>>  Conversely, removing unnecessary dependencies makes delightful code that is less buggy and easier to maintain because it is reusable without modification.

* The primary advantage of the MVC is that makes model classes reusable without modification.