Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Creating Applications using the Model-View-ViewModel Pattern<br />Matt Casto<br />http://google.com/profiles/mattcasto<br />
Developing Software is HARD<br />
Developing Software is HARD<br />
Patterns Help … but its still HARD!<br />
Model – View – ViewModel<br />
Model – View – Controller<br />
Model – View – Controller<br />Regarded as the first pattern to seperate UI, Data & Logic concerns<br />Controller handles...
Model – View – Presenter<br />
Model – View – Presenter<br />Variation of MVC<br />Tailored for modern UI that handles Mouse & Keyboard events better<br ...
Presentation Model<br />
Presentation Model<br />Published by Martin Fowler in 2004<br />View is a rendering of the Presentation Model<br />
Presentation Model<br />“Probably the most annoying part of Presentation Model is the synchronization between Presentation...
Model<br />
Model – Your Data<br />
Model – Your Data<br />Entities<br />Service Proxy<br />POCO<br />
Model – Your Data<br />View<br />
Model – Your Data<br />View – User Interface<br />
Model – Your Data<br />View – User Interface<br />XAML (WPF)<br />XAML w/ Code Behind (Silverlight)<br />
Model – Your Data<br />View – User Interface<br />ViewModel<br />
Model – Your Data<br />View – User Interface<br />ViewModel – The View’s Model<br />
Model – Your Data<br />View – User Interface<br />ViewModel – The View’s Model<br />State<br />Operations<br />Not Depende...
You’re probably already doing something very close to this<br />
You probably could be doing something very close to this<br />
Why do I care about MVVM?<br />
Why should you care about MVVM?<br />
Patterns are a set of guidelines<br />Patternsare not a set of rules<br />
Benefits of MVVM<br />
Benefits of MVVM<br /><ul><li>Loose Coupling
Testable Code
Maintainable Code</li></li></ul><li>Developers and Designers<br />
DEMO<br />WPF vsSilverlight<br />
DEMO<br />Adding Validation<br />
DEMO<br />Unit Testing<br />
DEMO<br />Commands<br />
MVVMSolutions<br /><ul><li>Component Application Guidance
MVVM Light Toolkit
Upcoming SlideShare
Loading in …5
×

Creating Applications Using The Model-View-ViewModel (MVVM) Pattern

9,533 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, News & Politics

Creating Applications Using The Model-View-ViewModel (MVVM) Pattern

  1. 1. Creating Applications using the Model-View-ViewModel Pattern<br />Matt Casto<br />http://google.com/profiles/mattcasto<br />
  2. 2. Developing Software is HARD<br />
  3. 3. Developing Software is HARD<br />
  4. 4. Patterns Help … but its still HARD!<br />
  5. 5. Model – View – ViewModel<br />
  6. 6. Model – View – Controller<br />
  7. 7. Model – View – Controller<br />Regarded as the first pattern to seperate UI, Data & Logic concerns<br />Controller handles all logic, including Mouse & Keyboard events<br />
  8. 8. Model – View – Presenter<br />
  9. 9. Model – View – Presenter<br />Variation of MVC<br />Tailored for modern UI that handles Mouse & Keyboard events better<br />Presenter depends on View<br />
  10. 10. Presentation Model<br />
  11. 11. Presentation Model<br />Published by Martin Fowler in 2004<br />View is a rendering of the Presentation Model<br />
  12. 12. Presentation Model<br />“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.” <br /> – Martin Fowler<br />
  13. 13. Model<br />
  14. 14. Model – Your Data<br />
  15. 15. Model – Your Data<br />Entities<br />Service Proxy<br />POCO<br />
  16. 16. Model – Your Data<br />View<br />
  17. 17. Model – Your Data<br />View – User Interface<br />
  18. 18. Model – Your Data<br />View – User Interface<br />XAML (WPF)<br />XAML w/ Code Behind (Silverlight)<br />
  19. 19. Model – Your Data<br />View – User Interface<br />ViewModel<br />
  20. 20. Model – Your Data<br />View – User Interface<br />ViewModel – The View’s Model<br />
  21. 21. Model – Your Data<br />View – User Interface<br />ViewModel – The View’s Model<br />State<br />Operations<br />Not Dependent on the View<br />
  22. 22. You’re probably already doing something very close to this<br />
  23. 23. You probably could be doing something very close to this<br />
  24. 24. Why do I care about MVVM?<br />
  25. 25. Why should you care about MVVM?<br />
  26. 26. Patterns are a set of guidelines<br />Patternsare not a set of rules<br />
  27. 27. Benefits of MVVM<br />
  28. 28. Benefits of MVVM<br /><ul><li>Loose Coupling
  29. 29. Testable Code
  30. 30. Maintainable Code</li></li></ul><li>Developers and Designers<br />
  31. 31. DEMO<br />WPF vsSilverlight<br />
  32. 32. DEMO<br />Adding Validation<br />
  33. 33. DEMO<br />Unit Testing<br />
  34. 34. DEMO<br />Commands<br />
  35. 35. MVVMSolutions<br /><ul><li>Component Application Guidance
  36. 36. MVVM Light Toolkit
  37. 37. Caliburn
  38. 38. Roll Your Own</li></li></ul><li>Sources<br /><ul><li>WPF Apps With The Model-View-ViewModel Design Pattern – Josh Smith</li></ul>http://msdn.microsoft.com/en-us/magazine/dd419663.aspx<br /><ul><li>Model-View-ViewModel In Silverlight 2 Apps – Shawn Wildermuth</li></ul>http://msdn.microsoft.com/en-us/magazine/dd458800.aspx<br /><ul><li>ViewModel Pattern in Silverlight using Behaviors – Nikhil Kothari</li></ul>http://www.nikhilk.net/Silverlight-ViewModel-Pattern.aspx<br /><ul><li>Using RoutedCommands with a ViewModel in WPF – Josh Smith</li></ul>http://www.codeproject.com/KB/WPF/VMCommanding.aspx<br /><ul><li>Presentation Model – Martin Fowler</li></ul>http://martinfowler.com/eaaDev/PresentationModel.html<br />
  39. 39. THANKS!!<br />Matt Casto<br />http://google.com/profiles/mattcasto<br />

×