MVC architecture

BaabtraMentoringPartner 1,117 views 15 slides Oct 31, 2012
Slide 1
Slide 1 of 15
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15

About This Presentation

MVC architecture


Slide Content

Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra – Mentoring Partner baabtra – Mentoring Partner is the mentoring division of baabte System Technologies Pvt. Ltd

MVC Architecture

What is MVC? The Model-View-Controller (MVC) architectural pattern separates an application into three main components: 1. Model 2. View 3. Controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications .

Model Model objects are the parts of the application that implement the logic for the applications data domain. Often, model objects retrieve and store model state in a database. In small applications, the model is often a conceptual separation instead of a physical one.

MVC   model  is basically a C# or VB.NET class A  model  is accessible by both  controller  and  view A  Controller  can be used to pass data from model   to  view A  view  can use model to display data in page.

View 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 Products object.

View is an ASPX page without having a code behind file All page specific HTML generation and formatting can be done inside view One can use Inline code (server tags ) to develop dynamic pages A request to  view  (ASPX page) can be made only from a controller’s action method.

Controller 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. 

Controller  is basically a C# or VB.NET class which inherits  system.mvc.controller Controller  is a heart of the entire  MVC   architecture Inside  Controller’s class  action methods can be implemented which are responsible for responding to browser OR calling views. Controller  can access and use  model  class to pass data to  views Controller  uses  ViewData   to pass any data to  view

Test-Driven Development The MVC pattern makes it easier to test applications than it is to test a Web Forms-based ASP.NET Web application.  Tests for Web Forms-based ASP.NET applications can therefore be more difficult to implement than tests in an MVC application 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. MVC application also promotes parallel development. 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. 

Advantages of an MVC-Based Web Application It makes it easier to manage complexity by dividing an application into the model, the view, and the controller. It does not use view state or server-based forms. This makes the MVC framework ideal for developers who want full control over the behavior of an application. It provides better support for test-driven development (TDD)

It works well for Web applications that are supported by large teams of developers and Web designers who need a high degree of control over the application behavior

Contact Us