SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
© 2009 SPR Companies. All rights reserved.
MPS Partners
An SPR Company
Brown Bag Lunch Series: 10/06/2010
An Introduction To ASP.NET MVC
by Mayank Srivastava
http://www.MayankSrivastava.com
Table of Contents
The Framework
Frequently
Bought Together
The Pattern
The Product
So what is MVC pattern?
Image from Wikipedia.org
Model-View-Controller is an architectural pattern that isolates "domain
logic" (the application logic for the user) from the user interface (input
and presentation), permitting independent development, testing and
maintenance of each (separation of concerns).
Basics
ASP.NET Web Forms
+ MVC Pattern
= ASP.NET MVC
ASP.NET
+ MVC Pattern
= ASP.NET MVC
ASP.NET == ASP.NET Web Forms
ASP.NET - The Song Remains The Same
Web Forms
Request (*.aspx) PageHandlerFactory
Responsible for page processing engine
Create a server form
Execute Page life cycle
Load View state / Control state
Server Form / Page
Response
(Browser understandable content)
Inheriting
System.Web.UI.Page
does the trick.
So what is MVC pattern?
Model
• Domain-specific representation of data
• Business logic
• Storage layer is an implementation detail
So what is MVC pattern?
View
• Presents data to the user
• Read-only views as well as forms
• Minimal display-only logic
So what is MVC pattern?
Controller
• Responds to requests
• Connects models to view
• Invokes model code as appropriate
MVC based ASP.NET framework
Request (URL) Controller
Response
(Browser understandable
content)
Model
View
-> Get the model (if needed)
-> Bind the model to the view (if needed)
->Render the view
Viewsknowhowtopresentmodels
Other related frameworks - http://en.wikipedia.org/wiki/Model%E2%80%93View%E2%80%93Controller
So what changed…
No Page life cycle
• No Server page, no server controls, only Views!
• Web is state ‘LESS’ environment.
• An asynchronous call should be an asynchronous call.
No View state
• Again, web is state ‘LESS’ environment.
• In hindsight, for the stateless web - state should be Model’s
responsibility, not View’s overhead.
No Postback
• Only Http verbs – Get, Post, Put, Delete.
Over to Visual Studio
A Quick comparison
• http://demos.telerik.com/aspnet-ajax/grid/examples/overview/defaultcs.aspx
• http://demos.telerik.com/aspnet-mvc/grid
Asynchronous when you need
Synchronous when you don’t
Web Forms
MVC
Try reload / paging on Telerik’s WebForm’s Grid and
compare the performance against Telerik’s MVC grid.
Page 14
Some more Super Hero talk
Page 15
Routing
It’s all about Routes, not file path.
 Application/Controller/Action/Parameter
 Or whatever you want
 Search Engine Optimization 
http://ProductsOnline.com/Products/Details/Batmobile
http://ProductsOnline.com/Products/Catalogs/List/SmartPhones
http://BlogSite.com/Blogs@1/30/2009
Imagine possibilities –
 Windows Workflow Foundation
 RSS feeds
 Window communication foundation
 The Browse / Ajaxify Pretty much anything!
Over to Visual Studio
Page 17
Deeper dive
Oh and by the way –
ASP.NET MVC, aka System.Web.Mvc, is Open Source
Check out the code on :- http://aspnet.codeplex.com/wikipage?title=MVC
Page 18
Frequently bought together
Customers Who Bought This Item Also Bought
• n-Tier application architecture (Separation of concern).
• IoC – Inversion of control (Dependency injection).
• TDD – Test Driven Development.
18
Page 19
Separation of Concern
What concern? Why are you concerned? My application works fine!
Remember Models?
Page 20
Separation of concern
Model Nothing but POCO
Domain-specific representation of
data
Domain Models
Business logic Business Layer
Storage layer is an implementation
detail
Data Access Layer
Page 21
Separation of concern
Most Common (rather default) Design Patterns
• Services Based for extendibility
• Repositories for Data Access Layer
Page 22
DI & IoC
Dependency injection
(Image - http://www.microbotic.org)
• Static kernel based container
• Control over scope (singleton, Request)
• Popular frameworks – Unity (Enterprise Library), StructureMap,
Ninject, Castle Windsor, Spring.NET…
Page 23
Inversion of Control
Database
Web Client
Services Repositories
ICacheService ICacheRepository
WP7 App
Facebook Canvas
Use HttpCacheService : ICacheService
& SQLCacheRepository : ICacheRepository
Use WPCacheService : ICacheService &
LocalFileCacheRepository : ICacheRepository
Use WPCacheService : ICacheService &
LocalFileCacheRepository : ICacheRepository
How should I handle your cache needs?
Page 24
Test Driven Development
Why is it the big breakthrough?
http://ASP.NET.WebForms.com/ProductList.aspx
Is it testable? – No… (at least not easily)
http://ASP.NET.MVC.com/Product/List
Is it testable? – Yes!
var product = new ProductController();
var result = product.List();
Page 25
Why MVC
• App Driven Development
• Industry moving towards Usability
• It’s all about user experience
Usability = (Functionality ^ Look) * Feel;
Page 26
Future?
Is this the end of Web Forms?
Now that MVC is here.
No! That’s ridicules!
(as on Channel9.MSDN.com)
Page 27
Future?
Flashback
Is this the end of VB?
Now that C# is here.
No! That’s ridicules!
However VB can’t be used on some cool stuff
like Window Phone, the .NET Micro Framework
err…I mean VB is equally good.
Page 28
Resources
Learning Resources:
http://www.asp.net/mvc
http://nerddinner.codeplex.com/
http://blog.wekeroad.com/2010/05/24/mvc-starter-2
Prominent bloggers:
Scott Guthrie - http://weblogs.asp.net/scottgu/
Scott Hanselman - http://www.hanselman.com/blog/
Phil Haak - http://haacked.com/
Rob Conery - http://blog.wekeroad.com/
Jon Galloway - http://weblogs.asp.net/jgalloway/
Stevens Anderson - http://blog.stevensanderson.com/
Brad Wilson - http://bradwilson.typepad.com/
Also:
Me :) - http://AspNetLive.BlogSpot.com/
Page 29
Questions

Weitere ähnliche Inhalte

Was ist angesagt?

Web technologies practical guide
Web technologies practical guideWeb technologies practical guide
Web technologies practical guidesamir azazy
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesThe Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesWesley Hales
 
Single page application and Framework
Single page application and FrameworkSingle page application and Framework
Single page application and FrameworkChandrasekar G
 
HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)robinzimmermann
 
Em presentation victor herman
Em presentation victor hermanEm presentation victor herman
Em presentation victor hermanVictor Herman
 
Single Page Apps
Single Page AppsSingle Page Apps
Single Page AppsGil Fink
 
WebNetConf 2012 - Single Page Apps
WebNetConf 2012 - Single Page AppsWebNetConf 2012 - Single Page Apps
WebNetConf 2012 - Single Page AppsPop Apps
 
Single page applications
Single page applicationsSingle page applications
Single page applicationsDiego Cardozo
 
single page application
single page applicationsingle page application
single page applicationRavindra K
 
HTML5 Offline Web Application
HTML5 Offline Web ApplicationHTML5 Offline Web Application
HTML5 Offline Web ApplicationAllan Huang
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applicationsSC5.io
 
Ajax Using JSP with prototype.js
Ajax Using JSP with prototype.jsAjax Using JSP with prototype.js
Ajax Using JSP with prototype.jsTushar Chauhan
 
Building High-Performance applications with .NET 5 and Vue JS 3
Building High-Performance applications with .NET 5 and Vue JS 3Building High-Performance applications with .NET 5 and Vue JS 3
Building High-Performance applications with .NET 5 and Vue JS 3Alexandre Malavasi
 
Lightweight webdev
Lightweight webdevLightweight webdev
Lightweight webdevdamianofusco
 
SGCE 2012 Lightning Talk-Single Page Interface
SGCE 2012 Lightning Talk-Single Page InterfaceSGCE 2012 Lightning Talk-Single Page Interface
SGCE 2012 Lightning Talk-Single Page InterfaceDomingo Suarez Torres
 

Was ist angesagt? (20)

Web technologies practical guide
Web technologies practical guideWeb technologies practical guide
Web technologies practical guide
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesThe Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devices
 
Single page application and Framework
Single page application and FrameworkSingle page application and Framework
Single page application and Framework
 
HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)
 
Offline Web Apps
Offline Web AppsOffline Web Apps
Offline Web Apps
 
Em presentation victor herman
Em presentation victor hermanEm presentation victor herman
Em presentation victor herman
 
Single Page Apps
Single Page AppsSingle Page Apps
Single Page Apps
 
WebNetConf 2012 - Single Page Apps
WebNetConf 2012 - Single Page AppsWebNetConf 2012 - Single Page Apps
WebNetConf 2012 - Single Page Apps
 
Single Page Applications
Single Page ApplicationsSingle Page Applications
Single Page Applications
 
Single page applications
Single page applicationsSingle page applications
Single page applications
 
single page application
single page applicationsingle page application
single page application
 
HTML5 Offline Web Application
HTML5 Offline Web ApplicationHTML5 Offline Web Application
HTML5 Offline Web Application
 
Introduction to headless browsers
Introduction to headless browsersIntroduction to headless browsers
Introduction to headless browsers
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applications
 
JavaCro'14 - Consuming Java EE Backends in Desktop, Web, and Mobile Frontends...
JavaCro'14 - Consuming Java EE Backends in Desktop, Web, and Mobile Frontends...JavaCro'14 - Consuming Java EE Backends in Desktop, Web, and Mobile Frontends...
JavaCro'14 - Consuming Java EE Backends in Desktop, Web, and Mobile Frontends...
 
Ajax Using JSP with prototype.js
Ajax Using JSP with prototype.jsAjax Using JSP with prototype.js
Ajax Using JSP with prototype.js
 
Building High-Performance applications with .NET 5 and Vue JS 3
Building High-Performance applications with .NET 5 and Vue JS 3Building High-Performance applications with .NET 5 and Vue JS 3
Building High-Performance applications with .NET 5 and Vue JS 3
 
Single Page Application
Single Page ApplicationSingle Page Application
Single Page Application
 
Lightweight webdev
Lightweight webdevLightweight webdev
Lightweight webdev
 
SGCE 2012 Lightning Talk-Single Page Interface
SGCE 2012 Lightning Talk-Single Page InterfaceSGCE 2012 Lightning Talk-Single Page Interface
SGCE 2012 Lightning Talk-Single Page Interface
 

Andere mochten auch

CNUG - Effective Data Visualization
CNUG - Effective Data VisualizationCNUG - Effective Data Visualization
CNUG - Effective Data VisualizationMayank Srivastava
 
CNUG ASP.NET MVC 4 – New Features
CNUG ASP.NET MVC 4 – New FeaturesCNUG ASP.NET MVC 4 – New Features
CNUG ASP.NET MVC 4 – New FeaturesMayank Srivastava
 
CNUG - Getting started on IoT Devices & Solutions using Windows 10 & Microsof...
CNUG - Getting started on IoT Devices & Solutions using Windows 10 & Microsof...CNUG - Getting started on IoT Devices & Solutions using Windows 10 & Microsof...
CNUG - Getting started on IoT Devices & Solutions using Windows 10 & Microsof...Mayank Srivastava
 

Andere mochten auch (6)

Why do you need REST
Why do you need RESTWhy do you need REST
Why do you need REST
 
CNUG - Effective Data Visualization
CNUG - Effective Data VisualizationCNUG - Effective Data Visualization
CNUG - Effective Data Visualization
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
CNUG ASP.NET MVC 4 – New Features
CNUG ASP.NET MVC 4 – New FeaturesCNUG ASP.NET MVC 4 – New Features
CNUG ASP.NET MVC 4 – New Features
 
CNUG TDD June 2014
CNUG TDD June 2014CNUG TDD June 2014
CNUG TDD June 2014
 
CNUG - Getting started on IoT Devices & Solutions using Windows 10 & Microsof...
CNUG - Getting started on IoT Devices & Solutions using Windows 10 & Microsof...CNUG - Getting started on IoT Devices & Solutions using Windows 10 & Microsof...
CNUG - Getting started on IoT Devices & Solutions using Windows 10 & Microsof...
 

Ähnlich wie Introduction to ASP.NET MVC

ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET PresentationRasel Khan
 
Mvc presentation
Mvc presentationMvc presentation
Mvc presentationMaslowB
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
What is ASP.NET MVC
What is ASP.NET MVCWhat is ASP.NET MVC
What is ASP.NET MVCBrad Oyler
 
Getting Started with Spring Framework
Getting Started with Spring FrameworkGetting Started with Spring Framework
Getting Started with Spring FrameworkEdureka!
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8Thomas Robbins
 
Web development concepts using microsoft technologies
Web development concepts using microsoft technologiesWeb development concepts using microsoft technologies
Web development concepts using microsoft technologiesHosam Kamel
 
Spring tutorials
Spring tutorialsSpring tutorials
Spring tutorialsTIB Academy
 
Sitecore MVC: What it is and why it's important
Sitecore MVC: What it is and why it's importantSitecore MVC: What it is and why it's important
Sitecore MVC: What it is and why it's importantnonlinear creations
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017Innovation Studio
 

Ähnlich wie Introduction to ASP.NET MVC (20)

ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
 
Mvc presentation
Mvc presentationMvc presentation
Mvc presentation
 
Aspnet mvc
Aspnet mvcAspnet mvc
Aspnet mvc
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
 
What is ASP.NET MVC
What is ASP.NET MVCWhat is ASP.NET MVC
What is ASP.NET MVC
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
 
Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
 
Mvc Brief Overview
Mvc Brief OverviewMvc Brief Overview
Mvc Brief Overview
 
Getting Started with Spring Framework
Getting Started with Spring FrameworkGetting Started with Spring Framework
Getting Started with Spring Framework
 
MSDN - ASP.NET MVC
MSDN - ASP.NET MVCMSDN - ASP.NET MVC
MSDN - ASP.NET MVC
 
MVC & backbone.js
MVC & backbone.jsMVC & backbone.js
MVC & backbone.js
 
ASP.NET MVC overview
ASP.NET MVC overviewASP.NET MVC overview
ASP.NET MVC overview
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
 
Web development concepts using microsoft technologies
Web development concepts using microsoft technologiesWeb development concepts using microsoft technologies
Web development concepts using microsoft technologies
 
Spring tutorials
Spring tutorialsSpring tutorials
Spring tutorials
 
Asp.Net MVC3 - Basics
Asp.Net MVC3 - BasicsAsp.Net MVC3 - Basics
Asp.Net MVC3 - Basics
 
Sitecore MVC: What it is and why it's important
Sitecore MVC: What it is and why it's importantSitecore MVC: What it is and why it's important
Sitecore MVC: What it is and why it's important
 
Asp.netmvc handson
Asp.netmvc handsonAsp.netmvc handson
Asp.netmvc handson
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017
 

Kürzlich hochgeladen

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 

Kürzlich hochgeladen (20)

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 

Introduction to ASP.NET MVC

  • 1. © 2009 SPR Companies. All rights reserved. MPS Partners An SPR Company Brown Bag Lunch Series: 10/06/2010 An Introduction To ASP.NET MVC by Mayank Srivastava http://www.MayankSrivastava.com
  • 2. Table of Contents The Framework Frequently Bought Together The Pattern The Product
  • 3. So what is MVC pattern? Image from Wikipedia.org Model-View-Controller is an architectural pattern that isolates "domain logic" (the application logic for the user) from the user interface (input and presentation), permitting independent development, testing and maintenance of each (separation of concerns).
  • 4. Basics ASP.NET Web Forms + MVC Pattern = ASP.NET MVC ASP.NET + MVC Pattern = ASP.NET MVC ASP.NET == ASP.NET Web Forms
  • 5. ASP.NET - The Song Remains The Same
  • 6. Web Forms Request (*.aspx) PageHandlerFactory Responsible for page processing engine Create a server form Execute Page life cycle Load View state / Control state Server Form / Page Response (Browser understandable content) Inheriting System.Web.UI.Page does the trick.
  • 7. So what is MVC pattern? Model • Domain-specific representation of data • Business logic • Storage layer is an implementation detail
  • 8. So what is MVC pattern? View • Presents data to the user • Read-only views as well as forms • Minimal display-only logic
  • 9. So what is MVC pattern? Controller • Responds to requests • Connects models to view • Invokes model code as appropriate
  • 10. MVC based ASP.NET framework Request (URL) Controller Response (Browser understandable content) Model View -> Get the model (if needed) -> Bind the model to the view (if needed) ->Render the view Viewsknowhowtopresentmodels Other related frameworks - http://en.wikipedia.org/wiki/Model%E2%80%93View%E2%80%93Controller
  • 11. So what changed… No Page life cycle • No Server page, no server controls, only Views! • Web is state ‘LESS’ environment. • An asynchronous call should be an asynchronous call. No View state • Again, web is state ‘LESS’ environment. • In hindsight, for the stateless web - state should be Model’s responsibility, not View’s overhead. No Postback • Only Http verbs – Get, Post, Put, Delete.
  • 12. Over to Visual Studio
  • 13. A Quick comparison • http://demos.telerik.com/aspnet-ajax/grid/examples/overview/defaultcs.aspx • http://demos.telerik.com/aspnet-mvc/grid Asynchronous when you need Synchronous when you don’t Web Forms MVC Try reload / paging on Telerik’s WebForm’s Grid and compare the performance against Telerik’s MVC grid.
  • 14. Page 14 Some more Super Hero talk
  • 15. Page 15 Routing It’s all about Routes, not file path.  Application/Controller/Action/Parameter  Or whatever you want  Search Engine Optimization  http://ProductsOnline.com/Products/Details/Batmobile http://ProductsOnline.com/Products/Catalogs/List/SmartPhones http://BlogSite.com/Blogs@1/30/2009 Imagine possibilities –  Windows Workflow Foundation  RSS feeds  Window communication foundation  The Browse / Ajaxify Pretty much anything!
  • 16. Over to Visual Studio
  • 17. Page 17 Deeper dive Oh and by the way – ASP.NET MVC, aka System.Web.Mvc, is Open Source Check out the code on :- http://aspnet.codeplex.com/wikipage?title=MVC
  • 18. Page 18 Frequently bought together Customers Who Bought This Item Also Bought • n-Tier application architecture (Separation of concern). • IoC – Inversion of control (Dependency injection). • TDD – Test Driven Development. 18
  • 19. Page 19 Separation of Concern What concern? Why are you concerned? My application works fine! Remember Models?
  • 20. Page 20 Separation of concern Model Nothing but POCO Domain-specific representation of data Domain Models Business logic Business Layer Storage layer is an implementation detail Data Access Layer
  • 21. Page 21 Separation of concern Most Common (rather default) Design Patterns • Services Based for extendibility • Repositories for Data Access Layer
  • 22. Page 22 DI & IoC Dependency injection (Image - http://www.microbotic.org) • Static kernel based container • Control over scope (singleton, Request) • Popular frameworks – Unity (Enterprise Library), StructureMap, Ninject, Castle Windsor, Spring.NET…
  • 23. Page 23 Inversion of Control Database Web Client Services Repositories ICacheService ICacheRepository WP7 App Facebook Canvas Use HttpCacheService : ICacheService & SQLCacheRepository : ICacheRepository Use WPCacheService : ICacheService & LocalFileCacheRepository : ICacheRepository Use WPCacheService : ICacheService & LocalFileCacheRepository : ICacheRepository How should I handle your cache needs?
  • 24. Page 24 Test Driven Development Why is it the big breakthrough? http://ASP.NET.WebForms.com/ProductList.aspx Is it testable? – No… (at least not easily) http://ASP.NET.MVC.com/Product/List Is it testable? – Yes! var product = new ProductController(); var result = product.List();
  • 25. Page 25 Why MVC • App Driven Development • Industry moving towards Usability • It’s all about user experience Usability = (Functionality ^ Look) * Feel;
  • 26. Page 26 Future? Is this the end of Web Forms? Now that MVC is here. No! That’s ridicules! (as on Channel9.MSDN.com)
  • 27. Page 27 Future? Flashback Is this the end of VB? Now that C# is here. No! That’s ridicules! However VB can’t be used on some cool stuff like Window Phone, the .NET Micro Framework err…I mean VB is equally good.
  • 28. Page 28 Resources Learning Resources: http://www.asp.net/mvc http://nerddinner.codeplex.com/ http://blog.wekeroad.com/2010/05/24/mvc-starter-2 Prominent bloggers: Scott Guthrie - http://weblogs.asp.net/scottgu/ Scott Hanselman - http://www.hanselman.com/blog/ Phil Haak - http://haacked.com/ Rob Conery - http://blog.wekeroad.com/ Jon Galloway - http://weblogs.asp.net/jgalloway/ Stevens Anderson - http://blog.stevensanderson.com/ Brad Wilson - http://bradwilson.typepad.com/ Also: Me :) - http://AspNetLive.BlogSpot.com/