Introduction to ASP.NET MVC

This mind map introduces ASP.NET MVC to existing web developers. Visit my blog at http://preetiedul.wordpress.com/bottom-of-the-stack/ to view other Mind Maps

Get Started. It's Free
or sign up with your email address
Rocket clouds
Introduction to ASP.NET MVC by Mind Map: Introduction to ASP.NET MVC

1. Product Information

1.1. Creator: Scott Guthrie (Scott Gu)

1.2. Program Manager @ Microsoft - Phil Haack

1.3. Release Timeline

1.3.1. Version 1.0 - March 2009

1.3.2. Version 2.0 - March 2010

2. Evolution

2.1. Common Gateway Interface (CGI)

2.1.1. Browser (Client) >> Sends Request to >> Executable Program (On Server) >> Sends HTML Output back to Browser

2.2. Active Server Pages (ASP)

2.2.1. Introduced "templating" in web pages

2.2.2. HTML & dynamic script lived side by side leading to spaghetti code

2.3. ASP.NET

2.3.1. Separated web page into aspx (HTML & dynamic server controls in XML format) and Code Behind (aspx.cs)

2.3.2. Overcomplicated ASP.NET Page Life Cycle, determining the right location in the life cycle for code was not intutive

2.3.3. Unit testing impossible or too difficult as everything was tightly coupled with the UI (System.Web)

2.3.4. View State did not scale well for large applications

2.3.5. Huge collection of ready to use controls

2.3.6. Automatic State Management

2.4. ASP.NET MVC

2.4.1. Implements the Model View Controller web presentation pattern

2.4.2. Clear separation of concerns

2.4.2.1. Data Model

2.4.2.2. Application Logic

2.4.2.3. Data Presentation

2.4.3. Postback cycle & Viewstate no longer necessary

3. What is MVC ?

3.1. Acronym for Model-View-Controller

3.1.1. Model

3.1.1.1. Contains the logic for the application data

3.1.1.2. In most cases writes model state to and from the database

3.1.2. View

3.1.2.1. Displays application's UI

3.1.2.2. UI is normally created from model data

3.1.2.3. Does not handle user inputs

3.1.3. Controller

3.1.3.1. Handle user interaction

3.1.3.2. Work with the Model to perform data manipulation

3.1.3.3. Selects a view and passes it the model data to be rendered

3.2. It is a "presentation" design pattern

3.3. Key principle is Seperation of Concerns (SoC)

3.3.1. Each component has a single responsibility

3.3.2. SRP: Single Responsibility Principle

3.3.3. DRY: Don't Repeat Yourself

3.3.4. Allows you to concentrate on a single aspect (e.g. UI) of the application without having to worry about the other

3.3.5. Easily testible due to loose coupling between elements

3.3.6. Elements can be tested in isolation from framework and other components

3.4. M-V-C

4. Can we mix ASP.NET & ASP.NET MVC in an application ?

4.1. YES !

4.2. ASP.NET MVC sits on top of ASP.NET (3.5)

4.3. It is not a replacement for webforms, rather an alternative

4.4. Does not replace ASP.NET (3.5) libraries or functionality

4.5. Phased migration from ASP.NET to ASP.NET MVC is possible by adding the MVC libraries and the routing data

4.6. Note that ASP.NET MVC works well with Web Application Projects (and not websites)

4.7. URL Routing HTTP Module in web.cofig decides who gets to process the request

4.7.1. If route is found >> ASP.NET MVC

4.7.2. If no route is found >> Webforms

5. Features of ASP.NET MVC

5.1. Test Driven Development (TDD)

5.1.1. All core contracts are interface based allowing them to be easily mocked

5.1.2. Loose coupling of elements allows for quick and easy unit testing

5.1.3. Any Unit Testing framework that is  compatible with .NET can be used

5.2. Highly Extensible & Pluggable

5.2.1. Interface based architecture

5.2.2. Very few sealed classes or methods

5.2.3. Easily replace components of the system with custom solutions

5.2.4. e.g. you can plug in your own view engine (instead of the winform template view engine)

5.3. URL Routing

5.3.1. User and Search Engine Optimization (SEO) friendly URLs

5.3.2. URLs do not need file extensions anymore

5.3.3. REST (Representational State Transfer) addressing

5.4. Heavy on Convention & Guidance (Convention over Configuration)

5.5. Built on top of ASP.NET, hence inherits all its features like Profiles / Membership / Security etc

5.6. Supports Post Redirect Get (PRG) pattern

6. WebForms OR ASP.NET MVC ?

6.1. Use Web Forms when ...

6.1.1. You want built in state management & postback mechanism

6.1.2. You need out of the box functionality. There is a huge pool of Server Controls for ASP.NET

6.1.3. You need rapid application development for small projects

6.1.4. Less code is needed in ASP.NET (than MVC) for smaller applications

6.1.5. ASP.NET uses Page Controller pattern (functionality in individual pages)

6.2. Use ASP.NET MVC when ...

6.2.1. You need complete control over application behavior (no default view state or post back)

6.2.2. You want to handle complexity by breaking the system into M-V-C

6.2.3. You need TDD (test driven development)

6.2.4. MVC uses Front Controller (single controller) pattern (supports rich routing infrastructure)

7. About

7.1. Description: This Mind Map introduces ASP.NET MVC to web developers

7.2. Created by: Preeti Edul

7.3. Visit my blog for more ASP.NET MVC mind maps http://preetiedul.wordpress.com/bottom-of-the-stack/