MVC is a design pattern used in software engineering, especially in the field of user interface programming. The MVC paradigm is a way of splitting an application, or even just a piece of an application’s interface, into three parts: the model, the view and the controller.
Here are some short principles to understand better MVC:
– actual content, usually stored in a database or XML file;
– must be independent, it can’t refer to either the view or the controller portions of the application; may not hold direct instance variables that refer to the view or the controller;
– should hold methods that manipulate the data.
– Should NEVER generate output directly
– any code necessary to generate your display
– obtains data from the model and presents it to the user
– reads data from the model using query methods provided by the model
– should not change the state of the model
– can communicate with the model but communication should be read-only
– returns the User Interface
– receives requests from the user, calls methods from the model(manipulate data) and the view(returns response to the user – usually HTML)
– Controlling Logic
– Pulls it all together
– Instantiates Models
– Causes Models to do something
– Hands the results of the model’s action to the view
– Renders the view
– Handles exceptions
– is NOT a mediator between the model and the view .
DotKernel team encourage the idea of “Fat Models, Skinny Controllers”.