SlideShare une entreprise Scribd logo
1  sur  34
ASP.NET MVC VolkanUzun
Web Developer at California State University, San Bernardino MS. Computer Science, MCP, and MCTS Interest Areas: TDD, Web Programming, Secure Coding User group maniac, visiting many user groups in a month Blog: http://www.msnetprogrammer.net/blog, Email: volkan@iedotnetug.org Twitter: http://www.twitter.com/volkanuzun About Me
Classic ASP (Another Slow Page!?) .NET Framework (Hurraay!!) ASP.NET v1.0 (No more slow pages) ASP.NET v1.1 ASP.NET v2.0 ASP.NET Ajax  ASP.NET 3.5 Silverlight ?!?! ASP.NET MVC ASP.NET WebForms 4.0 …. MS Web Developer History
Easy to learn but? Maintenance? Test? Debugging? Complexity? What was wrong with ASP?
Desktop like programming paradigm Lot’s of out ofbox controls No more spaghetti code? ASP.NET Web Forms
ViewState (supposed to    help you but?) DRY Can’t control HTML(Power is nothing without control) Best Practices?  Separation of Concerns? (I don’t have any concern) What is wrong with ASP.NET WebForms?
New Patterns
MVC Different people reading about MVC in different places take different ideas from it and describe these as “MVC”. Martin Fowler, GUI Architectures Essay (July  2006)
Model–View–Controller (MVC) is an architectural pattern  Formulated in 1979 by TrygveMikkjel Heyerdahl Reenskaug The model is the domain-specific representation of the data upon which the application operates The controller receives input and initiates a response by making calls on model objects. The view renders the model into a form suitable for interaction Wikipedia: MVC
[object Object]
NOT replacing ASP.NET Web Forms.
Giving you more control over html.
An easier to test framework.
Another option to web development.
Open source.
Convention over configuration.ASP.NET MVC
No View State, No Postback Very flexible, pluggable. Very clean URLs, rest friendly urls. Supports ASP.NET Providers: Membership Provider, Role Provider, Session, Cache etc… Open Source. Community Support. Supports Separation of Concerns. Plays well with others Why is it good?
Complete control over html!! No View State, No Postback!! Paradigm change. Few components . No formal validation support. Any Disadvantage?
WebForms are dead? MVC does not have as much support as WebForms? MVC guarantees better coding? A project is either MVC or WebForms? MVC is faster than WebForms? True / False
Browser requests /Products/List Route is selected Controller is activated (Products) Controller executes the action method (List) Action talks to Model, prepares the ViewData Action renders View But what is it?
Located in Controllers folder, You can change it derived from Controller base class The class name should be controller name + “Controller” Action Methods does the work Delete AccountController Move Controller’s to a separate project Controller
The ambiguous part of ASP.NET MVC M is the only part of MVC that is not implemented in ASP.NET MVC View Model: How your data looks on the page, flat data Domain Model: How your business data is, hierarchical data Any ORM is fine MODEL
Just renders the page, no biz logic!!! No ViewState, no server controls NO Codebehind, pls DON’T Default ViewEngine is WebForms Communicates with Controller with ViewData Dictionary Strongly Typed View VIEW
FILE => NEW… Project Structure
Separate Domain Model and View Model Use an ORM Use Repository Pattern Domain Model should only validate domain rules Presentation layer should NOT  care about persistence layer Best Practices on Model
FALSE ViewModel == DomainModel The most annoying part of Presentation Model is the synchronization between Presentation Model and view… Martin Fowler, GUI Architectures Essay, July 2004
Music Store App Display Albums Display Customers Refactor the Model Use AutoMapper DEMO
No Business Logic No Concrete Dependencies Small Action Methods Don’t mix HttpVerbs Avoid magic strings Use controller as a traffic flow manager Unit test your expectations All the public methods are web accessible Use OutputCache Best Practices on Controller
Define Views in an enum:return View(viewNames.Index); Even Better use T4MVC View.Model MVCContrib for RedirectToAction:return RedirectToAction<HomeController>(c=>c.Index) Removing Magics in Controller
Refactor View Names and Links with T4MVC Cache the output Write simple unit test DEMO
Dependency Injection private IBookRepositorybookRepository;public HomeController(){bookRepository = new BookRepository();} ,[object Object]
 Is it HomeContoller’s job to satisfy dependencies?
 Why does Home Controller have to know about BookRepository()?

Contenu connexe

Tendances

MVVM - Model View ViewModel
MVVM - Model View ViewModelMVVM - Model View ViewModel
MVVM - Model View ViewModelDareen Alhiyari
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event HandlingWebStackAcademy
 
Asp.net MVC training session
Asp.net MVC training sessionAsp.net MVC training session
Asp.net MVC training sessionHrichi Mohamed
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web APIhabib_786
 
What is Dependency Injection in Spring Boot | Edureka
What is Dependency Injection in Spring Boot | EdurekaWhat is Dependency Injection in Spring Boot | Edureka
What is Dependency Injection in Spring Boot | EdurekaEdureka!
 
MVVM ( Model View ViewModel )
MVVM ( Model View ViewModel )MVVM ( Model View ViewModel )
MVVM ( Model View ViewModel )Ahmed Emad
 
MVx patterns in iOS (MVC, MVP, MVVM)
MVx patterns in iOS (MVC, MVP, MVVM)MVx patterns in iOS (MVC, MVP, MVVM)
MVx patterns in iOS (MVC, MVP, MVVM)Yaroslav Voloshyn
 
Lecture 3: Servlets - Session Management
Lecture 3:  Servlets - Session ManagementLecture 3:  Servlets - Session Management
Lecture 3: Servlets - Session ManagementFahad Golra
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootJosué Neis
 
MVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros DeveloperMVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros DeveloperNyros Technologies
 
Angular 8
Angular 8 Angular 8
Angular 8 Sunil OS
 

Tendances (20)

Model View Controller (MVC)
Model View Controller (MVC)Model View Controller (MVC)
Model View Controller (MVC)
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 
MSDN - ASP.NET MVC
MSDN - ASP.NET MVCMSDN - ASP.NET MVC
MSDN - ASP.NET MVC
 
MVVM - Model View ViewModel
MVVM - Model View ViewModelMVVM - Model View ViewModel
MVVM - Model View ViewModel
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
 
Asp.net MVC training session
Asp.net MVC training sessionAsp.net MVC training session
Asp.net MVC training session
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web API
 
What is Dependency Injection in Spring Boot | Edureka
What is Dependency Injection in Spring Boot | EdurekaWhat is Dependency Injection in Spring Boot | Edureka
What is Dependency Injection in Spring Boot | Edureka
 
MVVM ( Model View ViewModel )
MVVM ( Model View ViewModel )MVVM ( Model View ViewModel )
MVVM ( Model View ViewModel )
 
MVx patterns in iOS (MVC, MVP, MVVM)
MVx patterns in iOS (MVC, MVP, MVVM)MVx patterns in iOS (MVC, MVP, MVVM)
MVx patterns in iOS (MVC, MVP, MVVM)
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 
Mvvm basics
Mvvm basicsMvvm basics
Mvvm basics
 
Lecture 3: Servlets - Session Management
Lecture 3:  Servlets - Session ManagementLecture 3:  Servlets - Session Management
Lecture 3: Servlets - Session Management
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
 
Mvc, mvp, mvvm...
Mvc, mvp, mvvm...Mvc, mvp, mvvm...
Mvc, mvp, mvvm...
 
MVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros DeveloperMVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros Developer
 
Vue.js
Vue.jsVue.js
Vue.js
 
Angular 8
Angular 8 Angular 8
Angular 8
 

En vedette

En vedette (6)

.NET and C# Introduction
.NET and C# Introduction.NET and C# Introduction
.NET and C# Introduction
 
C# basics
 C# basics C# basics
C# basics
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
 
C#.NET
C#.NETC#.NET
C#.NET
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net framework
 

Similaire à ASP.NET MVC Presentation

Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To MvcVolkan Uzun
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCBarry Gervin
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Shiju Varghese
 
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5  Building Your First Web Application (A Beginner S GuideASP.NET MVC 5  Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5 Building Your First Web Application (A Beginner S GuideAlicia Buske
 
Difference between asp.net web forms and asp.net mvc
Difference between asp.net web forms and asp.net mvcDifference between asp.net web forms and asp.net mvc
Difference between asp.net web forms and asp.net mvcUmar Ali
 
TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0Shiju Varghese
 
Deep Dive: MVC Controller Architecture
Deep Dive: MVC Controller ArchitectureDeep Dive: MVC Controller Architecture
Deep Dive: MVC Controller ArchitectureChris Eargle
 
Ppt of Basic MVC Structure
Ppt of Basic MVC StructurePpt of Basic MVC Structure
Ppt of Basic MVC StructureDipika Wadhvani
 
Which is better asp.net mvc vs asp.net
Which is better  asp.net mvc vs asp.netWhich is better  asp.net mvc vs asp.net
Which is better asp.net mvc vs asp.netConcetto Labs
 
MVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - IndiandotnetMVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - IndiandotnetIndiandotnet
 
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC eldorina
 
Getting Started with ASP.NET MVC
Getting Started with ASP.NET MVCGetting Started with ASP.NET MVC
Getting Started with ASP.NET MVCshobokshi
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Railscodeinmotion
 

Similaire à ASP.NET MVC Presentation (20)

Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
 
Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
 
ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
 
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5  Building Your First Web Application (A Beginner S GuideASP.NET MVC 5  Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
 
Php and-mvc
Php and-mvcPhp and-mvc
Php and-mvc
 
Asp.netmvc handson
Asp.netmvc handsonAsp.netmvc handson
Asp.netmvc handson
 
Difference between asp.net web forms and asp.net mvc
Difference between asp.net web forms and asp.net mvcDifference between asp.net web forms and asp.net mvc
Difference between asp.net web forms and asp.net mvc
 
TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0
 
No brainer
No brainerNo brainer
No brainer
 
Deep Dive: MVC Controller Architecture
Deep Dive: MVC Controller ArchitectureDeep Dive: MVC Controller Architecture
Deep Dive: MVC Controller Architecture
 
Ppt of Basic MVC Structure
Ppt of Basic MVC StructurePpt of Basic MVC Structure
Ppt of Basic MVC Structure
 
Which is better asp.net mvc vs asp.net
Which is better  asp.net mvc vs asp.netWhich is better  asp.net mvc vs asp.net
Which is better asp.net mvc vs asp.net
 
MVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - IndiandotnetMVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - Indiandotnet
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
 
Beyond The MVC
Beyond The MVCBeyond The MVC
Beyond The MVC
 
Getting Started with ASP.NET MVC
Getting Started with ASP.NET MVCGetting Started with ASP.NET MVC
Getting Started with ASP.NET MVC
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
 

Dernier

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
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
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
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 

Dernier (20)

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
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
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
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 

ASP.NET MVC Presentation

  • 2. Web Developer at California State University, San Bernardino MS. Computer Science, MCP, and MCTS Interest Areas: TDD, Web Programming, Secure Coding User group maniac, visiting many user groups in a month Blog: http://www.msnetprogrammer.net/blog, Email: volkan@iedotnetug.org Twitter: http://www.twitter.com/volkanuzun About Me
  • 3.
  • 4. Classic ASP (Another Slow Page!?) .NET Framework (Hurraay!!) ASP.NET v1.0 (No more slow pages) ASP.NET v1.1 ASP.NET v2.0 ASP.NET Ajax ASP.NET 3.5 Silverlight ?!?! ASP.NET MVC ASP.NET WebForms 4.0 …. MS Web Developer History
  • 5. Easy to learn but? Maintenance? Test? Debugging? Complexity? What was wrong with ASP?
  • 6. Desktop like programming paradigm Lot’s of out ofbox controls No more spaghetti code? ASP.NET Web Forms
  • 7. ViewState (supposed to help you but?) DRY Can’t control HTML(Power is nothing without control) Best Practices? Separation of Concerns? (I don’t have any concern) What is wrong with ASP.NET WebForms?
  • 9. MVC Different people reading about MVC in different places take different ideas from it and describe these as “MVC”. Martin Fowler, GUI Architectures Essay (July 2006)
  • 10. Model–View–Controller (MVC) is an architectural pattern  Formulated in 1979 by TrygveMikkjel Heyerdahl Reenskaug The model is the domain-specific representation of the data upon which the application operates The controller receives input and initiates a response by making calls on model objects. The view renders the model into a form suitable for interaction Wikipedia: MVC
  • 11.
  • 13. Giving you more control over html.
  • 14. An easier to test framework.
  • 15. Another option to web development.
  • 18. No View State, No Postback Very flexible, pluggable. Very clean URLs, rest friendly urls. Supports ASP.NET Providers: Membership Provider, Role Provider, Session, Cache etc… Open Source. Community Support. Supports Separation of Concerns. Plays well with others Why is it good?
  • 19. Complete control over html!! No View State, No Postback!! Paradigm change. Few components . No formal validation support. Any Disadvantage?
  • 20. WebForms are dead? MVC does not have as much support as WebForms? MVC guarantees better coding? A project is either MVC or WebForms? MVC is faster than WebForms? True / False
  • 21. Browser requests /Products/List Route is selected Controller is activated (Products) Controller executes the action method (List) Action talks to Model, prepares the ViewData Action renders View But what is it?
  • 22. Located in Controllers folder, You can change it derived from Controller base class The class name should be controller name + “Controller” Action Methods does the work Delete AccountController Move Controller’s to a separate project Controller
  • 23. The ambiguous part of ASP.NET MVC M is the only part of MVC that is not implemented in ASP.NET MVC View Model: How your data looks on the page, flat data Domain Model: How your business data is, hierarchical data Any ORM is fine MODEL
  • 24. Just renders the page, no biz logic!!! No ViewState, no server controls NO Codebehind, pls DON’T Default ViewEngine is WebForms Communicates with Controller with ViewData Dictionary Strongly Typed View VIEW
  • 25. FILE => NEW… Project Structure
  • 26. Separate Domain Model and View Model Use an ORM Use Repository Pattern Domain Model should only validate domain rules Presentation layer should NOT care about persistence layer Best Practices on Model
  • 27. FALSE ViewModel == DomainModel The most annoying part of Presentation Model is the synchronization between Presentation Model and view… Martin Fowler, GUI Architectures Essay, July 2004
  • 28. Music Store App Display Albums Display Customers Refactor the Model Use AutoMapper DEMO
  • 29. No Business Logic No Concrete Dependencies Small Action Methods Don’t mix HttpVerbs Avoid magic strings Use controller as a traffic flow manager Unit test your expectations All the public methods are web accessible Use OutputCache Best Practices on Controller
  • 30. Define Views in an enum:return View(viewNames.Index); Even Better use T4MVC View.Model MVCContrib for RedirectToAction:return RedirectToAction<HomeController>(c=>c.Index) Removing Magics in Controller
  • 31. Refactor View Names and Links with T4MVC Cache the output Write simple unit test DEMO
  • 32.
  • 33. Is it HomeContoller’s job to satisfy dependencies?
  • 34. Why does Home Controller have to know about BookRepository()?
  • 35.
  • 36. Extend ControllerFactory Use one of the IOC frameworks:StructureMap, Ninject, Windsor etc… Even Better Injection
  • 38. No Magic String (use T4MVC) Change ../ paths Strongly Typed View RenderPartial HtmlHelpers Use HTML if you can If there is an “If” , time to check HtmlHelpers Encode input string Best Practices On View
  • 40. Separate Controllers Use IoC No Business Logic in Controllers No Magic Strings in any component Use HTML Helpers DRY Test Strongly Types Views List of Practices
  • 41. Client side validation with JQuery Templating Strongly typed helpers Areas Support Async Controller Actions New Things With MVC 2
  • 42. Thanks to Jonas Follesø (http://jonas.follesoe.no) Thank you

Notes de l'éditeur

  1. Use Repository Pattern Separate the Model layer from Control layerMVC is in presentation layer, model is in persistence layerDon’t let your UI talk to business model directlyUse orm, orm is not for only if I change the db later…
  2. Use automapper, silverlight and wpf has binding support , and mvvm support