Mvvm pattern


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Mvvm pattern

  1. 1. MVVM Pattern<br />Mahender<br />Senior Software Engineer<br />United Health Group<br />
  2. 2. Mahender Sarangam<br />Having 5 years of experience on .NET Technologies. Working as a Senior Software Engineer in United Health Group (UHG India Information Service Ltd.). Worked with Big Firms like Deloitte Consulting & Wipro Technology. <br />Got Technical Acquaintance on Technologies like C#, ASP.NET,AJAX, LINQ, Silverlight, WPF,WCF ,SQL Server, Team Foundation Server(TFS) and SharePoint Technology. <br />MCTS Certified in Web Technologies.<br />Blog : <br />
  3. 3. Why Do need Pattern<br />Everything in code behind, is not a good idea<br />
  4. 4.
  5. 5. Why Do need Pattern<br />Basic Motivation of separation pattern<br />Removing logic from Code behind<br />Interchanging UI screens<br />Create Unit test case foe logic and UI<br />Developers and Designers can work parallel.<br />Model never needs to be changed to support changes to the view<br />No duplicated code to update views<br />So what is MVVM ?<br />Its variation of MVC pattern<br />John Gossman from WPF team <br />Resources from external assemblies<br />Martin Fowler's Presentation Model (PM) pattern<br />
  6. 6.
  7. 7. MVC & MVP Difference<br />
  8. 8.
  9. 9. Diagram<br />View Knows VIEW MODEL<br />VIEW MODEL Knows MODEL<br />BUT VIEWMODEL does not know View<br />View<br />View Model<br />Model<br />
  10. 10. View<br /><ul><li>Represents the user interface that the user will see.
  11. 11. Can be a user control or Data Template
  12. 12. Keep the view as simple as possible.</li></ul>Uses Binding to “subscribe” to the ViewModel<br />Interprets business data and state of ViewModel to the human<br />Nothing but Presentation - XAML<br />No or minimal code-behind<br />
  13. 13. View Model<br /><ul><li>An abstraction of View
  14. 14. Connector between View and Model
  15. 15. Keep View State, Value Conversion
  16. 16. No strong or weak (via Interface) reference of View
  17. 17. Make VM as testable as possible (e.g. no call to Singleton class)
  18. 18. No Control related Stuff in VM</li></ul>Provides data to and from the View<br />Responds to both the View and the Model<br />Informs the View of changes in the data<br />Reusable (at least much more than code behind a form)<br />
  19. 19. Model<br /><ul><li>Can be Data Model, DTO, POCO, auto-generated proxy of domain class and UI Model based on how you want to have the separation between Domain Service and Presentation Layer
  20. 20. No reference to View Model</li></ul>Typical class that covers a database<br />Could be a WCF Service and its client reference<br />
  21. 21. SupportingLibraires and Framework<br /><ul><li>WPF Team : MVVM Toolkit
  22. 22. MS Pattern and Practice Team : Composite WPF (Prism)
  23. 23. Josh Smith. "MVVM Foundation"
  24. 24. Sacha Barber. "Cinch."
  25. 25. Karl Shifflett. "Ocean"
  26. 26. Laurent Bugnion. "MVVM Light Toolkit"
  27. 27. Lester Lobo. "CoreMVVM"
  28. 28. Rob Eisenberg. "Caliburn"
  29. 29. William e Kempf. "Onyx"
  30. 30. Peter O’Hanlon. "GoldLight"
  31. 31. jbe. "WPF Application Framework (WAF)"
  32. 32. Paul Stovel : MacroModels</li></li></ul><li> Thank you<br />