Inevitably every programmer is going to encounter MVC architecture. MVC or model-view-controller is a pattern used by applications that divides the application into 3 parts. At first glance MVC can look more complicated than it is. Let’s look at the three parts.
Model – The model handles the data and cares about where the data is coming from. Typically it involves connecting to a database, but it could collect data by reading a file. The model only knows that data is there, it does not know what the data is or what you are doing with it.
View – The view cares about how to display the data. It doesn’t care where the data comes from or what the data means only that it is to display it.
Controller – The controller is the bridge between the Model and View it interprets the data and handles any calculations. It doesn’t care how the data is stored or how to display it. It does care what the data means.
The advantage of MVC is that you can change things in one part of the application without “breaking” the other parts. For example, you could change where the data comes from in the Model. Because the View and the Controller never knew where the data came from they are not effected by the change. Likewise, you could change how you want the data displayed in the View but neither the Model or the Controller is effected.
For example. Let say we are viewing Facebook. What you see is the view. When loading a FaceBook page the view tells the controller that it needs data, the controller gets the correct data from the Model and sends it back to the View. The View then displays that data. The Model and the Controller don’t care that the data is being displayed on a computer or on an iPhone application.
So it’s really not a very complicated architecture structure.