1 / 22

Architecting Silverlight Applications with MVVM

Architecting Silverlight Applications with MVVM . Shawn Wildermuth President AgiliTrain Session Code: WIA301 . The Problem. The Problem (2). Tight Coupling Adds Complexity Simple Changes Cascade Difficult to Test Difficult to Develop Large Applications. Separation of Concerns.

markku
Download Presentation

Architecting Silverlight Applications with MVVM

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Architecting Silverlight Applications with MVVM Shawn Wildermuth President AgiliTrain Session Code: WIA301

  2. The Problem

  3. The Problem (2) • Tight Coupling • Adds Complexity • Simple Changes Cascade • Difficult to Test • Difficult to Develop Large Applications

  4. Separation of Concerns • Loose Coupling • Layers are Individually Responsible • Established Patterns • Lessens the Need to Reinvent Architecture

  5. Patterns • Model-View-Controller • Model-View-Presenter • Model-View-ViewModel

  6. Patterns (2) • XAML is Declarative • Allows for Code-less Views • Older Patterns Don’t Fit

  7. Model-View-ViewModel Model View-Model View

  8. Model-View-ViewModel (2) Silverlight XAML View C#/VB ViewModel Model Internet Server C#/VB Services

  9. Building the MVVM • Planning on MVVM • Build in Tiers • Plan for Testing

  10. Building the MVVM (2) • The Model • Expose Data as Collections • Expose Methods for Different Data Shaping • More than one ViewModel May Use a single Model • Build Interface Providing Data • Allows Mocking of the Database if necessary • Eliminate Tight Coupling of Services with Model

  11. demo The Model

  12. Building the MVVM (4) • The ViewModel • Expose API that the View Needs • Use the Model to Provide the Data

  13. demo The ViewModel

  14. Building the MVVM (6) • The View • Declarative UI • Use as Much XAML as Possible • Don’t Write Code to Rebind Data • Perfect View is Code-less • In Silverlight 3 Behaviors and Element Binding Help

  15. demo The View

  16. Evolving Pattern • MVVM is Still Growing • Some Frameworks Support it (e.g. Prism) • Philosophy of Specifics is not settled • View-Centric • ViewModel-Centric • Marriage/Mediator • No Completely Right/Wrong Way to Implement It • Patterns Only Good If They Help

  17. Frameworks • I Hand-Coded MVVM • Frameworks Help • Laurent Bugnion’s Light MVVM • http://www.galasoft.ch/mvvm/getstarted/ • Nikhilk Kothari’s FX Framework • http://projects.nikhilk.net/SilverlightFX • Michael Sync’s Silverlight MVVM Toolkit • http://silverlightmvvm.codeplex.com/

  18. question & answer

  19. Resources • www.microsoft.com/teched Sessions On-Demand & Community • www.microsoft.com/learning • Microsoft Certification & Training Resources • http://microsoft.com/technet • Resources for IT Professionals • http://microsoft.com/msdn Resources for Developers

  20. Complete an evaluation on CommNet and enter to win an Xbox 360 Elite!

  21. Required Slide © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

More Related