1. Evolution
1.1. Common Gateway Interface (CGI)
1.1.1. Browser (Client) >> Sends Request to >> Executable Program (On Server) >> Sends HTML Output back to Browser
1.2. Active Server Pages (ASP)
1.2.1. Introduced "templating" in web pages
1.2.2. HTML & dynamic script lived side by side leading to spaghetti code
1.3. ASP.NET
1.3.1. Separated web page into aspx (HTML & dynamic server controls in XML format) and Code Behind (aspx.cs)
1.3.2. Overcomplicated ASP.NET Page Life Cycle, determining the right location in the life cycle for code was not intutive
1.3.3. Unit testing impossible or too difficult as everything was tightly coupled with the UI (System.Web)
1.3.4. View State did not scale well for large applications
1.3.5. Huge collection of ready to use controls
1.3.6. Automatic State Management
1.4. ASP.NET MVC
1.4.1. Implements the Model View Controller web presentation pattern
1.4.2. Clear separation of concerns
1.4.2.1. Data Model
1.4.2.2. Application Logic
1.4.2.3. Data Presentation
1.4.3. Postback cycle & Viewstate no longer necessary
2. Features of ASP.NET MVC
2.1. Test Driven Development (TDD)
2.1.1. All core contracts are interface based allowing them to be easily mocked
2.1.2. Loose coupling of elements allows for quick and easy unit testing
2.1.3. Any Unit Testing framework that is compatible with .NET can be used
2.2. Highly Extensible & Pluggable
2.2.1. Interface based architecture
2.2.2. Very few sealed classes or methods
2.2.3. Easily replace components of the system with custom solutions
2.2.4. e.g. you can plug in your own view engine (instead of the winform template view engine)
2.3. URL Routing
2.3.1. User and Search Engine Optimization (SEO) friendly URLs
2.3.2. URLs do not need file extensions anymore
2.3.3. REST (Representational State Transfer) addressing
2.4. Heavy on Convention & Guidance (Convention over Configuration)
2.5. Built on top of ASP.NET, hence inherits all its features like Profiles / Membership / Security etc
2.6. Supports Post Redirect Get (PRG) pattern
3. WebForms OR ASP.NET MVC ?
3.1. Use Web Forms when ...
3.1.1. You want built in state management & postback mechanism
3.1.2. You need out of the box functionality. There is a huge pool of Server Controls for ASP.NET
3.1.3. You need rapid application development for small projects
3.1.4. Less code is needed in ASP.NET (than MVC) for smaller applications
3.1.5. ASP.NET uses Page Controller pattern (functionality in individual pages)
3.2. Use ASP.NET MVC when ...
3.2.1. You need complete control over application behavior (no default view state or post back)
3.2.2. You want to handle complexity by breaking the system into M-V-C
3.2.3. You need TDD (test driven development)
3.2.4. MVC uses Front Controller (single controller) pattern (supports rich routing infrastructure)
4. Product Information
4.1. Creator: Scott Guthrie (Scott Gu)
4.2. Program Manager @ Microsoft - Phil Haack
4.3. Release Timeline
4.3.1. Version 1.0 - March 2009
4.3.2. Version 2.0 - March 2010
5. What is MVC ?
5.1. Acronym for Model-View-Controller
5.1.1. Model
5.1.1.1. Contains the logic for the application data
5.1.1.2. In most cases writes model state to and from the database
5.1.2. View
5.1.2.1. Displays application's UI
5.1.2.2. UI is normally created from model data
5.1.2.3. Does not handle user inputs
5.1.3. Controller
5.1.3.1. Handle user interaction
5.1.3.2. Work with the Model to perform data manipulation
5.1.3.3. Selects a view and passes it the model data to be rendered
5.2. It is a "presentation" design pattern
5.3. Key principle is Seperation of Concerns (SoC)
5.3.1. Each component has a single responsibility
5.3.2. SRP: Single Responsibility Principle
5.3.3. DRY: Don't Repeat Yourself
5.3.4. Allows you to concentrate on a single aspect (e.g. UI) of the application without having to worry about the other
5.3.5. Easily testible due to loose coupling between elements
5.3.6. Elements can be tested in isolation from framework and other components
5.4. M-V-C
6. Can we mix ASP.NET & ASP.NET MVC in an application ?
6.1. YES !
6.2. ASP.NET MVC sits on top of ASP.NET (3.5)
6.3. It is not a replacement for webforms, rather an alternative
6.4. Does not replace ASP.NET (3.5) libraries or functionality
6.5. Phased migration from ASP.NET to ASP.NET MVC is possible by adding the MVC libraries and the routing data
6.6. Note that ASP.NET MVC works well with Web Application Projects (and not websites)
6.7. URL Routing HTTP Module in web.cofig decides who gets to process the request
6.7.1. If route is found >> ASP.NET MVC
6.7.2. If no route is found >> Webforms