ASP.NET MVC
as the next step
in web development

                     Volodymyr Voytyshyn
                             08/27/2011
Goal

       What is ASP.NET MVC?
Contents

 About MVC Pattern
 ASP.NET Platform
 Sample Application
 ASP.NET MVC Project Concepts
 ASP.NET MVC Key Features
 MVC vs WebForms
 Conclusion
ABOUT MVC PATTERN
History of MVC Pattern

 Concept of MVC is described in 1979 by Trygve
  Reenskaug (Norway)

 One of the first version of MVC is implemented in
  Smalltallk-80 class library
Main Idea of MVC

    Separate view and data source


                   View




       Model              Controller
Classic MVC (Active Model)

                  View


                    Notify for
                    Changes
       Get data


                                        Controller



                  Model


                                 Mediator
             Data Source
Classic MVC (Passive Model)

           View
       Get data



                                   Controller


        Model



                        Mediator
     Data Source
MVP

      View




              Presenter



      Model   Mediator
MVP: Key Differences with Classic MVC

 Presenter knows all about View
 Presenter communicates with data source directly
 Events in Model and View removed
 Presenter implements main presentation logic
 Presenter is mediator between Model and View
ASP.NET PLATFORM
ASP.NET Web Forms Key Versions

                                           ASP.NET 4.0
                                              2010
                             ASP.NET 3.5
                                2007
               ASP.NET 2.0
                  2005
 ASP.NET 1.0
    2002




    ASP
    1998
ASP.NET MVC Key Versions


                                 ASP.NET MVC 3
                                      2011
                 ASP.NET MVC 2
                      2010
 ASP.NET MVC 1
      2009




   ASP.NET
ASP.NET Components


         Web Forms View Engine                Razor View Engine

        ASP.NET                              ASP.NET
       Web Forms                              MVC

                     ASP.NET Core
    Pages          Caching        Handlers             Roles
   Controls        Modules        Security          Profile

 Master Pages    Globalization   Membership            Etc.
SAMPLE APPLICATION
Concept

 Project name: “Easy Reporting”

 Idea: time tracking system for developers
Key Use Cases

uc Use Case




               Report w orking time   Confirm dev eloper's
                                         w orking time

  Dev eloper                                                     Manager




                                        Manage proj ects     Manage tasks
Components
   cmp Component


                                             Presentation Layer


                 ASP.NET                         «Web Application»                 «Class Library»
                Membership           «use»                               «use»
                                                      WebUI                        Castle Windsor



                                                                                 ASP.NET MVC 3
                                                        «use»
                                     «use»


                                             Data Access Layer


                                                                                 Entity Framework 4
                   «Class Library»                «Class Library»
                        DAL          «use»           Entities




             Repository Pattern
                                                          Linq to Entities



                                                Data Layer

            MS SQL Server 2008
                                                    «database»
                                                        ER
BASIC CONCEPTS OF MVC PROJECT
Typical MVC Project Structure
Simple Controller and Action
          ProjectController.cs




                                 Controller


 Action
Simple View
         Index.cshtml
Simple Client Page
MVC Implementation

                     Mediator

                     Controller
 Client




            View       Action




                      Model
ASP.NET MVC KEY FEATURES
Action Results

  ActionResult – base class of result of an action



      View                     File
      Redirect                 HTTP
      JavaScript               Content
      Json                     Empty
Action Filters
                        Filter types:         Filter scope:
                          – Authorization        – Action
     Action Filter        – Action               – Controller
                          – Result               – Application
                          – Exception


      Action
                                    Standard filters:
                                      – Authorize
                                      – HttpGet
                                      – HttpPost
     Action Filter
                                      – OutputCache
                                      – HandleError
Action Filters: Example
  ProjectController.cs
View Engines Concept



                                 Razor


  ASP.NET MVC          *.aspx / *.ascx / *.master


                                  Etc.
Passing data into View


                  Model


                 ViewData

   Action                   View
                 ViewBag


                 TempData
HTML Helpers


 HTML Helper – “server control” in ASP.NET MVC



 Classic HTML Helpers      Declarative HTML Helpers
Partial Views

   Partial view – “user control” in ASP.NET MVC

  _Layout.cshtml                 Header.cshtml




                                 Footer.cshtml
Layout pages and sections



  Layout page – “master page” in ASP.NET MVC




  Section – “ContentPlaceHolder” in ASP.NET MVC
Routing


                                            Controller
              URL
                       Routing
 Client                Engine                 Action

                                              Params




          Default route - /controller/action/id
Dependency Injection


  IServiceLocator    Setup         MvcServiceLocator


     Implement                          Controller Factory


                                           Controller
   Service Locator
                     Instantiate
  Implementation                          Action Filter


                                              View
Unit Testing

        Using
                                           Testable
 Inversion of Control
                                           Application
       principle



                    Can be tested:
                        –   Controllers
                        –   Routes
                        –   Html helpers
                        –   UI Models
                        –   View logic
                        –   Etc.
MVC Control Libraries

Client Side Controls    Server Side Controls

   JQuery IU              Telerik
   DOJO                   DevExpress
   Etc.                   Etc.
MVC VS WEBFORMS
When we do not need MVC?

 I need MVC, because
 … it is better than Web Forms
 … it implements MVC architecture
 … I want to escape from view state
 … I do not want automatically generated id in
 HTML
 … I want to get full control over HTML
 … I want more friendly URLs
MVC Benefits

 Automated testing
 Powerful AJAX client side
 Flexibility, extensibility, clarity
 Easy of learning and easy of using
 Clearly separated client side and server side
MVC Disadvantages

 Speed of development
  (particularly in early stages)

 … but you can win when you
  make changes in finished product
Conclusion
Contacts

                                   Volodymyr Voytyshyn
                                   5 Knyahyni Olhy Str., Rivne 33000, Ukraine


                                   Tel:       +38(066) 41 83 509

                                   E-mail:    vvoit@softserveinc.com
                                              voytyshyn@gmail.com

                                   Skype:     voytyshin




                                   Thank You!


Copyright © 2011 SoftServe, Inc.

More Related Content

PPTX
Continuous Delivery with VS2015 and TFS2015
PPTX
SPFx (SharePoint Framework)
PPTX
What’s new in Visual Studio 2012 & .NET 4.5
PPTX
Angle Forward with TypeScript
PPTX
Full stack web development
PPTX
React vs angular what to choose for your app
PPTX
Introduction to SharePoint Framework
PDF
Lessons Learned from Revamping Our Doc Site
Continuous Delivery with VS2015 and TFS2015
SPFx (SharePoint Framework)
What’s new in Visual Studio 2012 & .NET 4.5
Angle Forward with TypeScript
Full stack web development
React vs angular what to choose for your app
Introduction to SharePoint Framework
Lessons Learned from Revamping Our Doc Site

What's hot (19)

PPTX
Introducing Visual Studio Online
PDF
ReactJS or Angular
PPTX
Knockout, TypeScript, and Nested Grids, Oh My!
PDF
Top Web Development Frameworks Comparison: All You Need To Know
PPTX
Cross Platform Angular 2 and TypeScript Development
PPTX
Agile .NET Development with BDD and Continuous Integration
PPTX
JavaScript in Universal Windows Platform apps
PDF
React UI Development: Introduction to "UI Component as API"
PPTX
Angular overview
PPTX
Templates: Where Should Its Elements Be? In the Template or on Another Module?
PPTX
10 top web development frameworks (new version 21 11)
PPT
Microsoft Silverlight
PPTX
Latest Web development technologies 2021
PPTX
Asp.netmvc handson
PPTX
WebSite development using WinJS
PPTX
Top 5 Front End Development Tools For 2021
ODP
dot net
DOCX
Resume_new
Introducing Visual Studio Online
ReactJS or Angular
Knockout, TypeScript, and Nested Grids, Oh My!
Top Web Development Frameworks Comparison: All You Need To Know
Cross Platform Angular 2 and TypeScript Development
Agile .NET Development with BDD and Continuous Integration
JavaScript in Universal Windows Platform apps
React UI Development: Introduction to "UI Component as API"
Angular overview
Templates: Where Should Its Elements Be? In the Template or on Another Module?
10 top web development frameworks (new version 21 11)
Microsoft Silverlight
Latest Web development technologies 2021
Asp.netmvc handson
WebSite development using WinJS
Top 5 Front End Development Tools For 2021
dot net
Resume_new
Ad

Similar to ASP.NET MVC as the next step in web development (20)

PPTX
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
PDF
Jinal desai .net
PPTX
Head first asp.net mvc 2.0 rtt
PPT
Asp.net mvc
PDF
Spring MVC introduction HVA
PPT
MVC From Beginner to Advance in Indian Style by - Indiandotnet
PPT
Asp.net mvc
PPTX
Asp.Net MVC3 - Basics
PPTX
MVC 6 Introduction
PDF
PPTX
MVC Framework
PPT
MVC
PPTX
Aspnet mvc
PPTX
Give your web apps some backbone
ODP
Spring Portlet MVC
PPTX
What is ASP.NET MVC
PPT
CTTDNUG ASP.NET MVC
PPTX
Asp.net mvc 5 course module 1 overview
PPT
ASP.NET MVC Presentation
PPTX
Technoligent providing custom ASP.NET MVC development services
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
Jinal desai .net
Head first asp.net mvc 2.0 rtt
Asp.net mvc
Spring MVC introduction HVA
MVC From Beginner to Advance in Indian Style by - Indiandotnet
Asp.net mvc
Asp.Net MVC3 - Basics
MVC 6 Introduction
MVC Framework
MVC
Aspnet mvc
Give your web apps some backbone
Spring Portlet MVC
What is ASP.NET MVC
CTTDNUG ASP.NET MVC
Asp.net mvc 5 course module 1 overview
ASP.NET MVC Presentation
Technoligent providing custom ASP.NET MVC development services
Ad

More from Volodymyr Voytyshyn (6)

PDF
.NET Career Direction
PDF
Soft skills for Students
PDF
SPA: Key Questions
PDF
Modern JavaScript Applications: Design Patterns
PDF
Let trust our estimates
PDF
Managed Extensibility Framework
.NET Career Direction
Soft skills for Students
SPA: Key Questions
Modern JavaScript Applications: Design Patterns
Let trust our estimates
Managed Extensibility Framework

ASP.NET MVC as the next step in web development

  • 1. ASP.NET MVC as the next step in web development Volodymyr Voytyshyn 08/27/2011
  • 2. Goal What is ASP.NET MVC?
  • 3. Contents  About MVC Pattern  ASP.NET Platform  Sample Application  ASP.NET MVC Project Concepts  ASP.NET MVC Key Features  MVC vs WebForms  Conclusion
  • 5. History of MVC Pattern  Concept of MVC is described in 1979 by Trygve Reenskaug (Norway)  One of the first version of MVC is implemented in Smalltallk-80 class library
  • 6. Main Idea of MVC Separate view and data source View Model Controller
  • 7. Classic MVC (Active Model) View Notify for Changes Get data Controller Model Mediator Data Source
  • 8. Classic MVC (Passive Model) View Get data Controller Model Mediator Data Source
  • 9. MVP View Presenter Model Mediator
  • 10. MVP: Key Differences with Classic MVC  Presenter knows all about View  Presenter communicates with data source directly  Events in Model and View removed  Presenter implements main presentation logic  Presenter is mediator between Model and View
  • 12. ASP.NET Web Forms Key Versions ASP.NET 4.0 2010 ASP.NET 3.5 2007 ASP.NET 2.0 2005 ASP.NET 1.0 2002 ASP 1998
  • 13. ASP.NET MVC Key Versions ASP.NET MVC 3 2011 ASP.NET MVC 2 2010 ASP.NET MVC 1 2009 ASP.NET
  • 14. ASP.NET Components Web Forms View Engine Razor View Engine ASP.NET ASP.NET Web Forms MVC ASP.NET Core Pages Caching Handlers Roles Controls Modules Security Profile Master Pages Globalization Membership Etc.
  • 16. Concept  Project name: “Easy Reporting”  Idea: time tracking system for developers
  • 17. Key Use Cases uc Use Case Report w orking time Confirm dev eloper's w orking time Dev eloper Manager Manage proj ects Manage tasks
  • 18. Components cmp Component Presentation Layer ASP.NET «Web Application» «Class Library» Membership «use» «use» WebUI Castle Windsor ASP.NET MVC 3 «use» «use» Data Access Layer Entity Framework 4 «Class Library» «Class Library» DAL «use» Entities Repository Pattern Linq to Entities Data Layer MS SQL Server 2008 «database» ER
  • 19. BASIC CONCEPTS OF MVC PROJECT
  • 20. Typical MVC Project Structure
  • 21. Simple Controller and Action ProjectController.cs Controller Action
  • 22. Simple View Index.cshtml
  • 24. MVC Implementation Mediator Controller Client View Action Model
  • 25. ASP.NET MVC KEY FEATURES
  • 26. Action Results ActionResult – base class of result of an action  View  File  Redirect  HTTP  JavaScript  Content  Json  Empty
  • 27. Action Filters  Filter types:  Filter scope: – Authorization – Action Action Filter – Action – Controller – Result – Application – Exception Action  Standard filters: – Authorize – HttpGet – HttpPost Action Filter – OutputCache – HandleError
  • 28. Action Filters: Example ProjectController.cs
  • 29. View Engines Concept Razor ASP.NET MVC *.aspx / *.ascx / *.master Etc.
  • 30. Passing data into View Model ViewData Action View ViewBag TempData
  • 31. HTML Helpers HTML Helper – “server control” in ASP.NET MVC Classic HTML Helpers Declarative HTML Helpers
  • 32. Partial Views Partial view – “user control” in ASP.NET MVC _Layout.cshtml Header.cshtml Footer.cshtml
  • 33. Layout pages and sections Layout page – “master page” in ASP.NET MVC Section – “ContentPlaceHolder” in ASP.NET MVC
  • 34. Routing Controller URL Routing Client Engine Action Params Default route - /controller/action/id
  • 35. Dependency Injection IServiceLocator Setup MvcServiceLocator Implement Controller Factory Controller Service Locator Instantiate Implementation Action Filter View
  • 36. Unit Testing Using Testable Inversion of Control Application principle  Can be tested: – Controllers – Routes – Html helpers – UI Models – View logic – Etc.
  • 37. MVC Control Libraries Client Side Controls Server Side Controls  JQuery IU  Telerik  DOJO  DevExpress  Etc.  Etc.
  • 39. When we do not need MVC?  I need MVC, because … it is better than Web Forms … it implements MVC architecture … I want to escape from view state … I do not want automatically generated id in HTML … I want to get full control over HTML … I want more friendly URLs
  • 40. MVC Benefits  Automated testing  Powerful AJAX client side  Flexibility, extensibility, clarity  Easy of learning and easy of using  Clearly separated client side and server side
  • 41. MVC Disadvantages  Speed of development (particularly in early stages)  … but you can win when you make changes in finished product
  • 43. Contacts Volodymyr Voytyshyn 5 Knyahyni Olhy Str., Rivne 33000, Ukraine Tel: +38(066) 41 83 509 E-mail: [email protected] [email protected] Skype: voytyshin Thank You! Copyright © 2011 SoftServe, Inc.