Introduction to ASP.NET MVC 1.0

  • 2,530 views
Uploaded on

Introduction to ASP.NET MVC 1.0

Introduction to ASP.NET MVC 1.0

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,530
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
107
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

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