ASP.NET MVC Intro

Post on 05-Dec-2014

1.013 views 2 download

description

Introduzione ad ASP.NET MVC

Transcript of ASP.NET MVC Intro

ASP.NET MVCIntroduzione

web: www.manuelscapolan.itmail: info@manuelscapolan.it

Speaker: Manuel Scapolan

premessa

2

solo qualche slide

… quello dei documenti e

dei collegamenti ipertestuali

C’era una volta il web…

3

C’era una volta il web…

4

“bripp aiuuu gneeeep auuu ooooooo”

oggi invece …

5

Bruno Maia, IconTexto

http://www.icontexto.com

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

Ready?

7

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

8

Go!

HTTP Routing

9

Come!?

Quale metodo?

Di che classe?Convention over Configuration

{controller} nome della classe

{action} nome del metodo

{id} parametro opzionale

Controller

11

/food/bybrand/whiskas

/food/bybrand/whiskas

/food/bybrand/whiskas

e nel metodo

che si fa?

Model

16

… il model viene passato alla view,

che per convenzione ha lo stesso

nome della action

View

17

La view è un mix di markup e

codice che il view engine

trasformerà in codice html da

inviare al client

View

18

MVC requestin breve

pattern MVCin due parole

WebForm, really?

21

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

Il paradigma delle WebForm

22

Run-Time Stacka confronto

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)

Conclusione

25

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

Thank You! MANUEL SCAPOLAN

website: www.manuelscapolan.it

twitter: manuelscapolan

e-mail: info@manuelscapolan.it