Source MSDN
1
| |||||||||||||||||||||||||
MVC is a standard design pattern that many developers are familiar with. The Model-View-Controller
(MVC) architectural pattern separates an application into three main components: the model, the view,
and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms
pattern for creating Web applications. The MVC pattern helps you create applications that separate the
different aspects of the application (input logic, business logic, and UI logic), while providing a loose
coupling between these elements. The pattern specifies where each kind of logic should be located in
the application. The UI logic belongs in the view. Input logic belongs in the controller. Business logic
belongs in the model. This separation helps you manage complexity when you build an application,
because it enables you to focus on one aspect of the implementation at a time. For example, you can
focus on the view without depending on the business logic.
The loose coupling between the three main components of an MVC application also promotes parallel
development. For example, one developer can work on the view, a second developer can work on the
controller logic, and a third developer can focus on the business logic in the model.
| |||||||||||||||||||||||||
2
|
In which assembly is MVC framework defined?
| ||||||||||||||||||||||||
System.Web.Mvc
| |||||||||||||||||||||||||
3
| |||||||||||||||||||||||||
The MVC framework includes the following components:
Models. Model objects are the parts of the application that implement the logic for the application's data
domain. Often, model objects retrieve and store model state in a database. For example, a Product
object might retrieve information from a database, operate on it, and then write updated information
back to a Products table in a SQL Server database.
In small applications, the model is often a conceptual separation instead of a physical one. For example,
if the application only reads a dataset and sends it to the view, the application does not have a physical
model layer and associated classes. In that case, the dataset takes on the role of a model object.Views.
Views are the components that display the application's user interface (UI). Typically, this UI is created
from the model data. An example would be an edit view of a Products table that displays text boxes,
drop-down lists, and check boxes based on the current state of a Product object.Controllers. Controllers
are the components that handle user interaction, work with the model, and ultimately select a view to
render that displays UI. In an MVC application, the view only displays information; the controller handles
and responds to user input and interaction. For example, the controller handles query-string values,
and passes these values to the model, which in turn might use these values to query the database.
| |||||||||||||||||||||||||
4
| |||||||||||||||||||||||||
MVC pattern makes it easier to test applications than it is to test a Web Forms-based ASP.NET Web
application. For example, in a Web Forms-based ASP.NET Web application, a single class is used both to
display output and to respond to user input. Writing automated tests for Web Forms-based ASP.NET
applications can be complex, because to test an individual page, you must instantiate the page class,
all its child controls, and additional dependent classes in the application. Because so many classes are
instantiated to run the page, it can be hard to write tests that focus exclusively on individual parts of
the application. Tests for Web Forms-based ASP.NET applications can therefore be more difficult to
implement than tests in an MVC application. Moreover, tests in a Web Forms-based ASP.NET application
require a Web server. The MVC framework decouples the components and makes heavy use of
interfaces, which makes it possible to test individual components in isolation from the rest of the
framework.
|
This is an exception, Got some high level interview questions and answers. Thanks
ReplyDelete