Friday, February 1, 2013

MVC- Model View Controller

All the time we hear about it and the term itself made an image in mind. But still there is some fog in it. Recently i have got three definition regarding this three layers, and after that i am able to remove the fog about it:

MVC means Model-View-Controller where model is responsible for business logic, view handles the user interaction with application and controller decides the flow of application.
  • Model – A class which supplies the data needed for the application. 
  • View – A view element which displays the data.It displays the message returned by the Model class.
  • Controller – A controller class which will respond to user URL request. The controller will coordinate the actions of Model and the View. 


1) User sends the request using view which reaches to the controller on the server.
2) Controller decides the respective model and delivers the control to particular model.
3) As a result of business processing, model changes its state.
4) Depending on the state change of model, control redirects the flow to the view.
Main advantage of this architecture is the separation of data layer, presentation layer and pure business logic.

No comments: