MVC 3 Interview Questions
What is MVC (Model-View-Controller)
Controller – responsible for handling all user input
Model – represents the logic of the application
View – the visual representation of the model
MVC is a framework methodology it divides an application implementation into three component roles: models, views & controllers.
Models responsible for maintaining state. Often this state is persisted inside a database (for example: we might have a Product class that is used to represent order data from the Products table inside SQL).
Views responsible for displaying the application’s user interface. Typically this UI is created off of the model data (for example: we might create an Product “Edit” view that surfaces textboxes, dropdowns and checkboxes based on the current state of a Product object).
Controllers is responsible for handling end user interaction, manipulating the model, and ultimately choosing a view to render to display UI. In a MVC application View is only about displaying information – it is the controller that handles and responds to user input and interaction.