What is MVC (Model View Controller)? [closed]
I've heard the term MVC (Model View Controller) tossed about with a ton of Buzz lately, but what really is it?
You might want to take a look at what Martin Fowler has to say about MVC, MVP and UI architectures in general at Martin Fowlers site.
I like this article by Martin Fowler. You'll see that MVC is actually more or less dead, strictly speaking, in its original domain of rich UI programming. The distinction between View and Controller doesn't apply to most modern UI toolkits.
The term seems to have found new life in web programming circles recently. I'm not sure whether that's truly MVC though, or just re-using the name for some closely related but subtly different ideas.
MVC is a design pattern originally pioneered in the olden days of smalltalk.
The concept was that a model would represent your application state and logic, and controllers would handle IO between "Views".
A View was a representation of the state in the model. For example, your model may be a spreadsheet document, and you may have a view that represents it as a spreadsheet and a view that represents it as a pivot table.
Modern MVC has been polluted with fake MVC web junk, so I'll let others answer that.
Here is a naive description of MVC : http://www.devcodenote.com/2015/04/mvc-model-view-controller.html
A snippet:
Definition : It is a design pattern which separates an application into multiple layers of functionality.
The layers:
Model Represents data. It acts as an interface between the database and the application (as a data object). It will handle validations, associations, transactions etc.
Controller It gathers and processes data. Handles code which does data selection and data messaging.
View Displays output to the users.
As the tag on your question states its a design pattern. But that probably doesn't help you. Basically what it is, is a way to organize your code into logical groupings that keep the various pieces separate and easily modifiable.
Simplification: Model = Data structure / Business Logic View = Output layer (i.e HTML code) Controller = Message transfer layer
So when people talk about MVC what they are talking about is dividing up there code into these logical groups to keep it clean and structured, and hopefully loosely coupled. By following this design pattern you should be able to build applications that could have there View completely changed into something else without ever having to touch your controller or model (i.e. switching from HTML to RSS).
There are tons and tons of tutorials out there just google for it and I'm sure you'll turn up at least one that will explain it in terms that click with you.