Model view controller.

For years I have heard MVC model view controller banded about willie Nillie. 

I got the basics but finally I really get it. It should actually be called cmv or vmc. Not MVC. 

So how do these layers work. 

Let's start at the controller layer. 

The controller is where all and I mean all the data is dealt with. Using this layer classes Adler created the rerun Lists of items air a single item from the data. All items from his class are returned to the model in a structured data class or as a data type. This means that the model becomes data implementation agnostic. 

At no time should the model directly manipulate the data rather it works with the data types passed to it from the controller and uses those variances and structures to develop the logic or model on what happens to the data. 

Which brings us to the model. 

He model is the logic that links the controller to the view. Using the data the view provides it and manipulating or changing it view calculation or any other logic so it can be saved in the data or displayed via the view. You coils break this in to two layers toto. Creating view logic and calculated logic. Especially in C# where the code behind can call a model class to do the calc and logic to be view Independant. 

The view 
Once the model has all the applications logic the view is just used to display info to the user or send user entered data to the model and then the controller

He way data is viewed or displayed to he user is totally Independant of the model 

And that is why it is such a great concept since these layers could be independent of each other a different controller can be used. as the data and class calls are the same neither the model nor the view will care.

So perhaps it is worth having three folders one called class one called model and one called view. 





Comments

Popular Posts