ASP.NET MVC Intro

26
ASP.NET MVC Introduzione web: www.manuelscapolan.it mail: [email protected] Speaker: Manuel Scapolan

description

Introduzione ad ASP.NET MVC

Transcript of ASP.NET MVC Intro

Page 1: ASP.NET MVC Intro

ASP.NET MVCIntroduzione

web: www.manuelscapolan.itmail: [email protected]

Speaker: Manuel Scapolan

Page 2: ASP.NET MVC Intro

premessa

2

solo qualche slide

Page 3: ASP.NET MVC Intro

… quello dei documenti e

dei collegamenti ipertestuali

C’era una volta il web…

3

Page 4: ASP.NET MVC Intro

C’era una volta il web…

4

“bripp aiuuu gneeeep auuu ooooooo”

Page 5: ASP.NET MVC Intro

oggi invece …

5

Bruno Maia, IconTexto

http://www.icontexto.com

Page 6: ASP.NET MVC Intro

RequestGET http://www.google.it HTTP/1.1

Accept: text/html, */*

User-Agent: Mozilla/5.0

Accept-Encoding: gzip, deflate

Host: www.google.it

Response

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> …

Page 7: ASP.NET MVC Intro

Ready?

7

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

Page 8: ASP.NET MVC Intro

8

Go!

Page 9: ASP.NET MVC Intro

HTTP Routing

9

Page 10: ASP.NET MVC Intro

Come!?

Quale metodo?

Di che classe?Convention over Configuration

Page 11: ASP.NET MVC Intro

{controller} nome della classe

{action} nome del metodo

{id} parametro opzionale

Controller

11

Page 12: ASP.NET MVC Intro

/food/bybrand/whiskas

Page 13: ASP.NET MVC Intro

/food/bybrand/whiskas

Page 14: ASP.NET MVC Intro

/food/bybrand/whiskas

Page 15: ASP.NET MVC Intro

e nel metodo

che si fa?

Page 16: ASP.NET MVC Intro

Model

16

Page 17: ASP.NET MVC Intro

… il model viene passato alla view,

che per convenzione ha lo stesso

nome della action

View

17

Page 18: ASP.NET MVC Intro

La view è un mix di markup e

codice che il view engine

trasformerà in codice html da

inviare al client

View

18

Page 19: ASP.NET MVC Intro

MVC requestin breve

Page 20: ASP.NET MVC Intro

pattern MVCin due parole

Page 21: ASP.NET MVC Intro

WebForm, really?

21

MVC non è l’unico modo di fare web con ASP.NET

Page 22: ASP.NET MVC Intro

Il paradigma delle WebForm

22

Page 23: ASP.NET MVC Intro

Run-Time Stacka confronto

Page 24: ASP.NET MVC Intro

Undisputable

facts

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.

“Comparing Web Forms And ASP.NET MVC”

(MSDN Magazine - Dino Esposito)

Page 25: ASP.NET MVC Intro

Conclusione

25

Embrace HTTP and HTML—don't hide it (Chris Tavares)

Page 26: ASP.NET MVC Intro

Thank You! MANUEL SCAPOLAN

website: www.manuelscapolan.it

twitter: manuelscapolan

e-mail: [email protected]