KEMBAR78
ASP.NET MVC Intro | PDF
ASP.NET MVC
      Introduzione


Speaker: Manuel   Scapolan   web: www.manuelscapolan.it
                               mail: info@manuelscapolan.it
premessa
    solo qualche slide

                     2
C’era una volta il web…

   … quello dei documenti e
    dei collegamenti ipertestuali




                                            3
C’era una volta il web…




“bripp aiuuu gneeeep auuu ooooooo”



                                          4
oggi invece …




Bruno Maia, IconTexto
http://www.icontexto.com

                           5
Request
GET http://www.google.it HTTP/1.1
           Accept: text/html, */*
          User-Agent: Mozilla/5.0
    Accept-Encoding: gzip, deflate
             Host: www.google.it




                                     HTTP/1.1 200 OK
                                     Date: Fri, 27 May 2011 01:27:20 GMT
                                     Content-Type: text/html; charset=UTF-8;
                                     expires=Sun, 26-May-2013 01:27:20 GMT;
                                     <!doctype html><html><head> …

                                     Response
Vediamo come ASP.NET MVC risponde alla richiesta di un utente

                                Ready?
                                                            7
Go!




      8
HTTP Routing




               9
Come!?
Quale metodo?
 Di che classe?
       Convention over Configuration
Controller




 {controller}nome della classe
 {action} nome del metodo
 {id} parametro opzionale



                                     11
/food/bybrand/whiskas




        …
/food/bybrand/whiskas
/food/bybrand/whiskas
e nel metodo
    che si fa?
Model




        16
View

   … il model viene passato alla view,
    che per convenzione ha lo stesso
    nome della action




                                          17
View

   La view è un mix di markup e
    codice che il view engine
    trasformerà in codice html da
    inviare al client




                                           18
MVC request
        in breve
in due parole

pattern   MVC
MVC non è l’unico modo di fare web con ASP.NET
WebForm, really?
                                                 21
Il paradigma delle WebForm




                             22
Run-Time Stack
           a confronto
“Comparing Web Forms And ASP.NET MVC”
                                                             (MSDN Magazine - Dino Esposito)
   Web Forms is hard to test.
   ASP.NET MVC requires you to manage the generation of HTML at a more detailed level.
   ASP.NET MVC is not the only way to get SoC in ASP.NET.
   Web Forms allows you to learn as you go.
   Viewstate can be controlled or disabled.
   Web Forms was designed to abstract the Web machinery.
   ASP.NET MVC exposes Web architecture.
   ASP.NET MVC was designed with testability and Dependency Injection in mind.
   ASP.NET MVC takes you towards a better design of the code.
   ASP.NET MVC is young and lacks a component model.
   ASP.NET MVC is not anti-Web Forms.




                                    Undisputable
                                           facts
Conclusione
Embrace HTTP and HTML—don't hide it (Chris Tavares)
                                                 25
Thank You!   MANUEL SCAPOLAN
             website: www.manuelscapolan.it
             twitter: manuelscapolan
             e-mail: info@manuelscapolan.it

ASP.NET MVC Intro

  • 1.
    ASP.NET MVC Introduzione Speaker: Manuel Scapolan web: www.manuelscapolan.it mail: info@manuelscapolan.it
  • 2.
    premessa solo qualche slide 2
  • 3.
    C’era una voltail web…  … quello dei documenti e dei collegamenti ipertestuali 3
  • 4.
    C’era una voltail web… “bripp aiuuu gneeeep auuu ooooooo” 4
  • 5.
    oggi invece … BrunoMaia, IconTexto http://www.icontexto.com 5
  • 6.
    Request GET http://www.google.it HTTP/1.1 Accept: text/html, */* User-Agent: Mozilla/5.0 Accept-Encoding: gzip, deflate Host: www.google.it HTTP/1.1 200 OK Date: Fri, 27 May 2011 01:27:20 GMT Content-Type: text/html; charset=UTF-8; expires=Sun, 26-May-2013 01:27:20 GMT; <!doctype html><html><head> … Response
  • 7.
    Vediamo come ASP.NETMVC risponde alla richiesta di un utente Ready? 7
  • 8.
  • 9.
  • 10.
    Come!? Quale metodo? Diche classe? Convention over Configuration
  • 11.
    Controller  {controller}nome dellaclasse  {action} nome del metodo  {id} parametro opzionale 11
  • 12.
  • 13.
  • 14.
  • 15.
    e nel metodo che si fa?
  • 16.
  • 17.
    View  … il model viene passato alla view, che per convenzione ha lo stesso nome della action 17
  • 18.
    View  La view è un mix di markup e codice che il view engine trasformerà in codice html da inviare al client 18
  • 19.
    MVC request in breve
  • 20.
  • 21.
    MVC non èl’unico modo di fare web con ASP.NET WebForm, really? 21
  • 22.
  • 23.
    Run-Time Stack a confronto
  • 24.
    “Comparing Web FormsAnd ASP.NET MVC” (MSDN Magazine - Dino Esposito)  Web Forms is hard to test.  ASP.NET MVC requires you to manage the generation of HTML at a more detailed level.  ASP.NET MVC is not the only way to get SoC in ASP.NET.  Web Forms allows you to learn as you go.  Viewstate can be controlled or disabled.  Web Forms was designed to abstract the Web machinery.  ASP.NET MVC exposes Web architecture.  ASP.NET MVC was designed with testability and Dependency Injection in mind.  ASP.NET MVC takes you towards a better design of the code.  ASP.NET MVC is young and lacks a component model.  ASP.NET MVC is not anti-Web Forms. Undisputable facts
  • 25.
    Conclusione Embrace HTTP andHTML—don't hide it (Chris Tavares) 25
  • 26.
    Thank You! MANUEL SCAPOLAN website: www.manuelscapolan.it twitter: manuelscapolan e-mail: info@manuelscapolan.it