MVC 4.0
Session Objective(s): Introduce the ASP.NET MVC feature Demonstrate App Building using ASP.NET MVC
Key Takeaways: ASP.NET MVC puts you in full
control of your application ASP.NET MVC is awesome
Session Objectives And Takeaways
Web 2.0
Why does it seem there are so
few built using ASP.NET
What is Web 2.0?
Marketing hot air?
Or are there some concrete characteristics?
What is ASP.NET MVC? A new Web Application Project type
Simply an option
Not a replacement for WebForms
Builds on top ASP.NET
Manual vs Automatic Transmission
How was it developed?
Transparently Regular source code releases on CodePlex Previews 1 5, Beta thus far. 6 releases! Community feedback via forums, etc
Agilely 94% Code Coverage/1051 unit tests Daily Triage Meetings and weekly design
meetings Small agile team
What is MVC?
A design pattern
Acronym for Model View Controller
Separation of concerns
What is MVC?
Step 1Incoming request directed to Controller
RequestRequest
ControllerController
What is MVC?
Step 2Controller processes request and forms a data Model
ControllerController
Model
What is MVC?
Step 3Model is passed to View
ControllerController
ViewView
What is MVC?
Step 4View transforms Model into appropriate output format
ControllerController
ViewView
What is MVC?
Step 5Response is rendered
ResponseResponse
ControllerController
ViewView
Framework Goals
Frictionless Testability
Tight control over markup
User/SEO friendly URLs
Leverage the benefits of ASP.NET
Conventions and Guidance
Separation Of Concerns
Each component has one responsibility
SRP Single Responsibility Principle
DRY Dont Repeat Yourelf
More easily testable
Helps with concurrent development
Extensible
Replace any component of the system
Interface-based architecture
Very few sealed methods / classes
Plays well with others
WebForms are great
Mature, proven technology
Scalable
Extensible
Familiar feel to WinForms developers
but they have challenges
Abstractions arent very abstract
Difficult to test
Lack of control over markup
It does things you didnt tell it to do
Summary
Not a replacement for WebForms All about alternatives
Fundamental Part of the System.Web namespace Same team that builds WebForms
Providers still work Membership, Caching, Session, etc.
Views leverage .aspx and .ascx But they dont have to if you dont want them
to Within System.Web namespace Feature Sharing
SummaryIts still ASP.NET
Replace Any Part with one of your own As simple or complex as it needs to be to
suit your tasks Plays well with others
Want to use NHibernate for models? OK! Want to use Brail for views? OK! Want to use VB for controllers? OK!
SummaryExtensible
REST-like Fits with the nature of the web
MVC exposes the stateless nature of HTTP Friendlier to humans Friendlier to web crawlers
Search engine optimization (SEO)
SummaryClean URL Structure
Ill be at the PDC Lounge Tuesday, October 28 3:00 PM 6:00 PM if you have more questions.
Breakout Sessions/Chalk Talks: PC30 ASP.NET Dynamic Data PC31 ASP.NET and Jquery PC32 ASP.NET Ajax Futures PC33 Microsoft Visual Studio: Easing ASP.NET Web PC41 ASP.NET Cache Extensibility TL20 EF Futures TL07 Developing Applications using Data Services TL48 Microsoft Visual Studio: Web Development
Futures ES15 Deploying Web Applications with Microsoft IIS
7.0 and the Web Deployment Tool
Related content
Choosing Between The Two
Appendix
You want full control over markup You want a framework that enforces separation
of concerns TDD/Unit Testing is a priority for you Control abstractions get in your way more than
they help You like writing Javascript
You Might be an MVC ifWith Apologies to Jeff Foxworthy
You like programming against the reusable control abstraction that encapsulate UI and logic
You like using the WYSWIG designer and would rather avoid angle brackets
You like keeping logic on the server rather than hand writing Javascript
Unit testing with the MVP pattern is sufficient for your needs
You Might be a WebForm ifWith Apologies to Jeff Foxworthy
Slide 1Session Objectives And TakeawaysWeb 2.0What is ASP.NET MVC?How was it developed?What is MVC?What is MVC?What is MVC?What is MVC?What is MVC?What is MVC?Framework GoalsSeparation Of ConcernsExtensibleWebForms are great but they have challengesSummarySlide 18Slide 19Slide 20Related contentChoosing Between The TwoSlide 23Slide 24Slide 25