introducing asp.net mvc alan dean. model-view-controller (mvc) is a well-known design pattern the...
TRANSCRIPT
![Page 1: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/1.jpg)
Introducing ASP.NET MVC
Alan Dean
![Page 2: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/2.jpg)
Model-View-Controller (MVC)is a well-known design pattern
The original 1978 implementation is described
in depth in the influential 1992 paper“Applications Programming in Smalltalk-80:How to use Model-View-Controller (MVC)”
by Steve Burbeck
![Page 3: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/3.jpg)
…“the concept of the design pattern in software provides a key to helping
developers leverage the expertise of other skilled architects.”
Grady Booch, 1995
![Page 4: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/4.jpg)
![Page 5: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/5.jpg)
MVC consists of three kinds of objects
The Model is the application object
The View is the screen presentation
The Controller defines the way the user interface reacts to user input
![Page 6: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/6.jpg)
Before MVC, user interface designs tended
to lump these objects together
MVC decouples them toincrease flexibility and reuse
![Page 7: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/7.jpg)
Controller
Model View
![Page 8: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/8.jpg)
In his paperSteve Burbeck describes two variations of
MVC
a passive model and an active model
![Page 9: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/9.jpg)
The passive model is employed when one controller manipulates the model
exclusively
The controller modifies the model and then informs the view that the model has
changed and should be refreshed
The model in this scenario is completely independent of the view and the
controller, which means that there is no means for the model to report changes in
its state
![Page 10: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/10.jpg)
Controller View Model
handleEventservice
update
getData
![Page 11: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/11.jpg)
The HTTP protocol is an example of this.
The browser displays the view and responds to user input, but it does not detect changes in the data on
the server.
Only when the browser explicitly requests a refresh is the server
interrogated for changes.
![Page 12: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/12.jpg)
Separation of Concerns (SoC)
Object types become ‘pluggable’
Intra-team dependency is reduced
Testability is enhanced
Application flow can be hard to grok
![Page 13: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/13.jpg)
MVC Web FrameworksJava has Swing, Struts, Grails and
othersPerl has Catalyst, Gantry, Jifty and
othersPHP has Zend, Zoop, Agavi and othersPython has Django, Gluon, Pylon and
othersRuby on Rails is famously
‘opinionated’
… and .NET?
![Page 14: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/14.jpg)
.NET MVC Web Frameworks
Spring.NEThttp://www.springframework.net/
Maverick.NEThttp://mavnet.sourceforge.net/
MonoRailhttp://www.castleproject.org/monorail/
… and now ASP.NET MVC from Microsofthttp://asp.net/downloads/3.5-extensions/
![Page 15: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/15.jpg)
“The ASP.NET MVC framework is a lightweight, highly testable
presentation framework that is integrated with existing ASP.NET
features, such as master pages and membership-based authentication.
The MVC framework is defined in the System.Web.Mvc namespace and is
a fundamental, supported part of the System.Web namespace”
![Page 16: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/16.jpg)
Wiki
A wiki is software that allows users to create, edit, and link
web pages easily
![Page 17: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/17.jpg)
Ward Cunningham, developer of the first wiki, WikiWikiWeb, originally
described it as
"the simplest online database that could possibly work"
![Page 18: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/18.jpg)
Wiki HTTP API
GET /GET /page.html
POST /pageGET /page/[title]
GET /page/[title].txtGET /page/[title].htmlGET /page/[title].atom
PUT /page/[title]DELETE /page/[title]
![Page 19: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/19.jpg)
GET
The GET method means retrieve whatever information (in the form of
an entity) is identified by the Request-URI.
Safe & Idempotent
![Page 20: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/20.jpg)
POST
The POST method is used to request that the origin server accept the
entity enclosed in the request as a new subordinate of the resource
identified by the Request-URI
![Page 21: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/21.jpg)
PUT
The PUT method requests that the enclosed entity be stored under the supplied
Request-URI.
If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified
version of the one residing on the origin server.
Idempotent
![Page 22: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/22.jpg)
DELETE
The DELETE method requests that the origin server delete the resource
identified by the Request-URI.
Idempotent
![Page 23: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/23.jpg)
![Page 24: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/24.jpg)
REpresentational State Transfer
![Page 25: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/25.jpg)
REST: The Web Used Correctly
A system or application architecture
… that uses HTTP, URI and other Webstandards “correctly”
… is “on” the Web, not tunnelled through it
![Page 26: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/26.jpg)
REST is an Architectural Style
Defines a set of key “constraints”
… that, if met, make an architecture “RESTful”
… with the Web as one example
![Page 27: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/27.jpg)
Equate “REST” with “RESTful HTTP usage”
Stefan Tilkov
![Page 28: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/28.jpg)
Deriving REST
Client-ServerStateless
CacheUniform interfaceLayered system
Code on Demand
![Page 29: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/29.jpg)
“The central feature that distinguishes the REST architectural style from other network-based styles is its emphasis on a uniform interface
between components.”
Roy Fielding
![Page 30: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/30.jpg)
Uniform InterfaceUniform resource identification
A set of well-defined operations for manipulation
A shared set of media-types
Hypertext as the engine of application state
![Page 31: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/31.jpg)
Benefits of REST
Hypertext is standardizedfewer UIs
Identification is standardizedless communication
Exchange protocols are standardizedfewer integrations
Interactions are standardizedfewer semantics
Data formats are standardizedfewer translations
![Page 32: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/32.jpg)
“No matter how hard I try, I still think the WS-* stack is bloated, opaque, and insanely complex. I think it is
going to be hard to understand, hard to implement, hard to interoperate,
and hard to secure.”
Tim Bray (XML Co-inventor)
![Page 33: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/33.jpg)
“If you’re ready for REST I suggest you jump on board right away and
get ahead of the curveYou’ll have to train your developers in
REST principles.You definitely need to provide
guidance to your people.What you want to do is work to the
point where REST becomes the default for all your distributed
applications.”
Anne Thomas Manes (Burton Group)
![Page 34: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/34.jpg)
![Page 35: Introducing ASP.NET MVC Alan Dean. Model-View-Controller (MVC) is a well-known design pattern The original 1978 implementation is described in depth in](https://reader036.vdocuments.net/reader036/viewer/2022081515/56649f115503460f94c2447e/html5/thumbnails/35.jpg)
Linkshttp://del.icio.us/tag/aspnetmvc
http://code.google.com/p/alan-dean/http://code.google.com/p/altnetuk/
© MMVIII