Creating Applications Using The Model-View-View Model Pattern

5,455 views

Published on

Need a new acronym for your resume? The Model-View-ViewModel (MVVM) pattern is a variation of Model-View-Presenter (MVP) that is tailored for modern UI development platforms where the View is the responsibility of a designer rather than the developer. This has lead to the pattern becoming very popular with WPF and Silverlight application developers lately. This presentation will walk you through creating a business application from scratch in both WPF and Silverlight using the MVVM pattern.

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,455
On SlideShare
0
From Embeds
0
Number of Embeds
49
Actions
Shares
0
Downloads
174
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Creating Applications Using The Model-View-View Model Pattern

  1. 1. Creating Applications using the Model-View-ViewModel Pattern Matt Casto mattcasto@gmail.com http://twitter.com/mattcasto
  2. 2. Developing Software is HARD
  3. 3. Developing Software is HARD
  4. 4. Patterns Help … but its still HARD!
  5. 5. Model – View – ViewModel
  6. 6. Model – View – Controller
  7. 7. Model – View – Controller • Regarded as the first pattern to seperate UI, Data & Logic concerns • Controller handles all logic, including Mouse & Keyboard events
  8. 8. Model – View – Presenter
  9. 9. Model – View – Presenter • Variation of MVC • Tailored for modern UI that handles Mouse & Keyboard events better • Presenter depends on View
  10. 10. Presentation Model
  11. 11. Presentation Model • Published by Martin Fowler in 2004 • View is a rendering of the Presentation Model
  12. 12. Presentation Model “Probably the most annoying part of Presentation Model is the synchronization between Presentation Model and view. It’s simple code to write, but I always like to minimize this kind of boring repetitive code. Ideally some kind of framework could handle this, which I’m hoping will happen someday with technologies like .NET’s data binding.” – Martin Fowler
  13. 13. Model
  14. 14. Model – Your Data
  15. 15. Model – Your Data • Entities • Service Proxy • POCO
  16. 16. Model – Your Data View
  17. 17. Model – Your Data View – User Interface
  18. 18. Model – Your Data View – User Interface • XAML (WPF) • XAML w/ Code Behind (Silverlight)
  19. 19. Model – Your Data View – User Interface ViewModel
  20. 20. Model – Your Data View – User Interface ViewModel – The View’s Model
  21. 21. Model – Your Data View – User Interface ViewModel – The View’s Model • State • Operations • Not Dependent on the View
  22. 22. You’re probably already doing something very close to this
  23. 23. You probably could be doing something very close to this
  24. 24. Why do I care about MVVM?
  25. 25. Why should you care about MVVM?
  26. 26. Patterns are a set of guidelines Patterns are not a set of rules
  27. 27. Benefits of MVVM
  28. 28. Benefits of MVVM • Loose Coupling • Testable Code • Maintainable Code
  29. 29. Developers and Designers
  30. 30. DEMO WPF vs Silverlight
  31. 31. DEMO Adding Validation
  32. 32. DEMO Unit Testing
  33. 33. DEMO Commands
  34. 34. Enterprisey Solutions • Component Application Guidance • Caliburn • Roll Your Own
  35. 35. Sources • WPF Apps With The Model-View-ViewModel Design Pattern – Josh Smith http://msdn.microsoft.com/en-us/magazine/dd419663.aspx • Model-View-ViewModel In Silverlight 2 Apps – Shawn Wildermuth http://msdn.microsoft.com/en-us/magazine/dd458800.aspx • ViewModel Pattern in Silverlight using Behaviors – Nikhil Kothari http://www.nikhilk.net/Silverlight-ViewModel-Pattern.aspx • Using RoutedCommands with a ViewModel in WPF – Josh Smith http://www.codeproject.com/KB/WPF/VMCommanding.aspx • Presentation Model – Martin Fowler http://martinfowler.com/eaaDev/PresentationModel.html
  36. 36. THANKS!! Matt Casto mattcasto@gmail.com http://twitter.com/mattcasto

×