0
Shiju Varghese http://weblogs.asp.net/shijuvarghese
Session Objectives <ul><li>Introduction to ASP.NET MVC </li></ul><ul><li>Demonstrate programming  using ASP.NET MVC </li><...
What’s wrong with ASP.NET WebForm <ul><li>ViewState </li></ul><ul><li>Page life cycle </li></ul><ul><li>Limited control ov...
What is MVC <ul><li>A design pattern </li></ul><ul><li>Acronym for Model View Controller </li></ul><ul><li>Isolating busin...
What is MVC <ul><li>View is just concerned about presentation logic </li></ul><ul><li>Models represent the data </li></ul>...
Why a new model <ul><li>A lot of developers asking for it. </li></ul><ul><ul><li>Simpler way to program ASP.NET </li></ul>...
What is ASP.NET MVC <ul><li>An alternative framework to ASP.NET Web Forms. </li></ul><ul><li>More control over your HTML <...
Goals of ASP.NET MVC Framework <ul><li>Enable clean separation of concerns </li></ul><ul><ul><li>Each component has one re...
Goals of ASP.NET MVC Framework <ul><li>Extensible and Pluggable framework. </li></ul><ul><ul><li>Interface-based architect...
ASP.NET MVC doesn’t have <ul><li>Postbacks </li></ul><ul><li>View state </li></ul><ul><li>Control state </li></ul><ul><li>...
ASP.NET MVC still has… <ul><li>Web designer </li></ul><ul><li>Master pages </li></ul><ul><li>User controls </li></ul><ul><...
URL Routing  <ul><li>Browser Request is mapped to controller action through URL Routing. URL Routing route the incoming re...
URL Routing
How it works Browser List.aspx (View) Web Server CategoryController (Controller) http://myserver.com/category/List http://...
Request Flow <ul><li>Browser requests /Category/ </li></ul><ul><li>Route is determined </li></ul><ul><li>Controller is act...
Request Flow
Summary <ul><li>Not a replacement for WebForm </li></ul><ul><ul><li>Just an alternative option </li></ul></ul><ul><ul><li>...
Summary – Extensible Framework <ul><li>Replace any part with your own </li></ul><ul><li>All are pluggable </li></ul><ul><u...
Summary - Clean URL Structure <ul><li>REST based Architecture </li></ul><ul><li>Fits with the nature of the Web </li></ul>...
Showcase of  live ASP.NET MVC application <ul><li>http:// stackoverflow.com / </li></ul><ul><ul><li>A Web 2.0 application ...
ASP.NET MVC Versus WebForm <ul><li>Web Form </li></ul><ul><ul><li>Big Design Up Front (BDUF) methodology </li></ul></ul><u...
ASP.NET MVC Versus WebForm <ul><li>Web Forms </li></ul><ul><ul><li>ViewState, Page Execution Lifecycle, Postback Services ...
Consider MVC model, If <ul><li>You want full control over HTML </li></ul><ul><li>You want a framework that enforces separa...
Consider WebForms model, If <ul><li>You want programming against the reusable control abstractions that encapsulate UI and...
You must use MVC model, If <ul><li>You want adopt agile methodology </li></ul><ul><li>You are a DDD/TDD believer </li></ul...
Resources <ul><li>ASP.NET MVC site -  http:// as.net/mvc </li></ul><ul><li>Blogs </li></ul><ul><li>Scott Guthrie </li></ul...
Questions?
Thanks Shiju Varghese E-Mail :  [email_address] Blog :  http:// weblogs.asp.net/shijuvarghese Twitter :  http:// twitter.c...
Upcoming SlideShare
Loading in...5
×

Introduction to ASP.NET MVC 1.0

2,612

Published on

Introduction to ASP.NET MVC 1.0

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,612
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
108
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Introduction to ASP.NET MVC 1.0"

  1. 1. Shiju Varghese http://weblogs.asp.net/shijuvarghese
  2. 2. Session Objectives <ul><li>Introduction to ASP.NET MVC </li></ul><ul><li>Demonstrate programming using ASP.NET MVC </li></ul>
  3. 3. What’s wrong with ASP.NET WebForm <ul><li>ViewState </li></ul><ul><li>Page life cycle </li></ul><ul><li>Limited control over rendered HTML </li></ul><ul><li>Lack of Separation of Concerns (SoC) </li></ul><ul><li>Untestable </li></ul>
  4. 4. What is MVC <ul><li>A design pattern </li></ul><ul><li>Acronym for Model View Controller </li></ul><ul><li>Isolating business logic from UI </li></ul><ul><li>Layering for UI layer </li></ul><ul><li>Separation of Concerns (SoC) </li></ul><ul><ul><li>Separate content from presentation and data-processing (model) from content </li></ul></ul>
  5. 5. What is MVC <ul><li>View is just concerned about presentation logic </li></ul><ul><li>Models represent the data </li></ul><ul><li>Controllers just handle application flow </li></ul><ul><li>You write less code and end up with a more maintainable application. </li></ul>
  6. 6. Why a new model <ul><li>A lot of developers asking for it. </li></ul><ul><ul><li>Simpler way to program ASP.NET </li></ul></ul><ul><ul><li>Enable separation of concerns and testability </li></ul></ul><ul><ul><li>Model-view-controller presentation pattern is a time-tested pattern that scales with size and complexity </li></ul></ul><ul><ul><li>Complete control over Html generated </li></ul></ul>
  7. 7. What is ASP.NET MVC <ul><li>An alternative framework to ASP.NET Web Forms. </li></ul><ul><li>More control over your HTML </li></ul><ul><li>A more easily testable framework </li></ul><ul><li>Simply an option </li></ul><ul><ul><li>Will not a replacement for Web Form </li></ul></ul><ul><ul><li>Build on top of ASP.NET </li></ul></ul><ul><li>Opinionated Framework </li></ul><ul><ul><li>Community Driven Framework </li></ul></ul><ul><ul><li>Source code on CodePlex </li></ul></ul>
  8. 8. Goals of ASP.NET MVC Framework <ul><li>Enable clean separation of concerns </li></ul><ul><ul><li>Each component has one responsibility </li></ul></ul><ul><ul><ul><li>Single Responsibility Principle (SRP) </li></ul></ul></ul><ul><ul><ul><li>Highly testable and maintainable application </li></ul></ul></ul><ul><li>Testable by default (built with TDD in mind) </li></ul><ul><ul><li>Red/Green/Refactor TDD </li></ul></ul><ul><li>Enable full control over the rendered HTML </li></ul><ul><li>Enable clean URLs and HTML </li></ul><ul><ul><li>SEO and REST friendly URL structures </li></ul></ul>
  9. 9. Goals of ASP.NET MVC Framework <ul><li>Extensible and Pluggable framework. </li></ul><ul><ul><li>Interface-based architecture </li></ul></ul><ul><ul><li>Support replacing any component of the system </li></ul></ul><ul><ul><li>Support third-party view engines such as NVelocity, Brail, NHaml </li></ul></ul><ul><ul><li>Support user-provided front controller that enable Inversion of Control containers </li></ul></ul><ul><li>Build on top of ASP.NET </li></ul><ul><li>Support static and dynamic languages </li></ul><ul><li>Conventions and Guidance </li></ul>
  10. 10. ASP.NET MVC doesn’t have <ul><li>Postbacks </li></ul><ul><li>View state </li></ul><ul><li>Control state </li></ul><ul><li>Server-side form </li></ul><ul><li>Page/Control lifecycle </li></ul>
  11. 11. ASP.NET MVC still has… <ul><li>Web designer </li></ul><ul><li>Master pages </li></ul><ul><li>User controls </li></ul><ul><li>Membership/Roles/Profile </li></ul><ul><li>Globalization </li></ul><ul><li>Caching </li></ul><ul><li>HTTP intrinsics objects </li></ul>
  12. 12. URL Routing <ul><li>Browser Request is mapped to controller action through URL Routing. URL Routing route the incoming requests to controller actions. </li></ul><ul><li>URL Routing uses Route Table that will be created when application first starts. </li></ul><ul><li>Route table is setup in the Global.asax file. </li></ul>
  13. 13. URL Routing
  14. 14. How it works Browser List.aspx (View) Web Server CategoryController (Controller) http://myserver.com/category/List http://myserver.com/category/Edit/5 Edit.aspx (View) Database Employeee (Model)
  15. 15. Request Flow <ul><li>Browser requests /Category/ </li></ul><ul><li>Route is determined </li></ul><ul><li>Controller is activated </li></ul><ul><li>Method on Controller is invoke </li></ul><ul><li>Controller does some stuff </li></ul><ul><li>Renders View, passing in custom ViewData </li></ul>
  16. 16. Request Flow
  17. 17. Summary <ul><li>Not a replacement for WebForm </li></ul><ul><ul><li>Just an alternative option </li></ul></ul><ul><ul><li>Not for everyone </li></ul></ul><ul><li>Build on top of ASP.NET </li></ul><ul><ul><li>Providers still work </li></ul></ul><ul><ul><ul><li>Membership, Caching, Session </li></ul></ul></ul><ul><ul><li>Views leverage .aspx and .acx </li></ul></ul>
  18. 18. Summary – Extensible Framework <ul><li>Replace any part with your own </li></ul><ul><li>All are pluggable </li></ul><ul><ul><li>Views </li></ul></ul><ul><ul><li>Controllers </li></ul></ul><ul><ul><li>Models </li></ul></ul><ul><ul><li>Routes </li></ul></ul>
  19. 19. Summary - Clean URL Structure <ul><li>REST based Architecture </li></ul><ul><li>Fits with the nature of the Web </li></ul><ul><ul><li>ASP.NET MVC exposes the stateless nature of HTTP </li></ul></ul><ul><li>Search Engine Optimization (SEO) </li></ul>
  20. 20. Showcase of live ASP.NET MVC application <ul><li>http:// stackoverflow.com / </li></ul><ul><ul><li>A Web 2.0 application </li></ul></ul><ul><ul><li>Q & A website for developers </li></ul></ul><ul><ul><li>Blend of Wikis, Blogs, Forums, and Digg/Reddit </li></ul></ul><ul><li>Oxite </li></ul><ul><ul><li>Microsoft’s open source platform for CMS/Blog </li></ul></ul><ul><ul><li>Used to develop MIX Online ( http://visitmix.com ) </li></ul></ul>
  21. 21. ASP.NET MVC Versus WebForm <ul><li>Web Form </li></ul><ul><ul><li>Big Design Up Front (BDUF) methodology </li></ul></ul><ul><ul><li>RAD and WinForm programming experience </li></ul></ul><ul><li>MVC </li></ul><ul><ul><li>Not doing Big Design Up Front (BDUF) </li></ul></ul><ul><ul><li>“ Close to the Metal” Programming Experience </li></ul></ul>
  22. 22. ASP.NET MVC Versus WebForm <ul><li>Web Forms </li></ul><ul><ul><li>ViewState, Page Execution Lifecycle, Postback Services </li></ul></ul><ul><ul><li>Not Easy to Test </li></ul></ul><ul><ul><li>Not Easy to Search (SEO) </li></ul></ul><ul><li>MVC </li></ul><ul><ul><li>No ViewState, Page Execution Lifecycle, Postback Services </li></ul></ul><ul><ul><li>Highly Testable </li></ul></ul><ul><ul><li>Easy Search (SEO) </li></ul></ul>
  23. 23. Consider MVC model, If <ul><li>You want full control over HTML </li></ul><ul><li>You want a framework that enforces separation of concerns </li></ul><ul><li>TDD/Unit Testing is priority for you </li></ul><ul><li>Control abstractions get in your way more than they help </li></ul><ul><li>You want easy integration with JavaScript </li></ul>
  24. 24. Consider WebForms model, If <ul><li>You want programming against the reusable control abstractions that encapsulate UI and logic </li></ul><ul><li>You want RAD and Windows Form development experience </li></ul><ul><li>You want to develop heavy data-driven Line of Business (LOB) Applications. </li></ul>
  25. 25. You must use MVC model, If <ul><li>You want adopt agile methodology </li></ul><ul><li>You are a DDD/TDD believer </li></ul><ul><li>You want to develop public face internet applications and Web 2.0 applications </li></ul>
  26. 26. Resources <ul><li>ASP.NET MVC site - http:// as.net/mvc </li></ul><ul><li>Blogs </li></ul><ul><li>Scott Guthrie </li></ul><ul><li>http:// weblogs.asp.net/scottgu </li></ul><ul><li>Phill Haack </li></ul><ul><li>http:// haacked.com </li></ul><ul><li>Stephen Walther </li></ul><ul><li>http:// weblogs.asp.net/stephenwalther </li></ul>
  27. 27. Questions?
  28. 28. Thanks Shiju Varghese E-Mail : [email_address] Blog : http:// weblogs.asp.net/shijuvarghese Twitter : http:// twitter.com/shijucv
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×