Software Development and Design Using MVVM
Jeff Jackson
[email protected] @jeffjax
Overview
Why do we need MVVM? What is MVVM? Easy on slides, heavy on code MVVM in practice Questions Technologies
-
WPF, Silverlight, Windows Phone, WinRT (Metro)
Traditional WPF Approach
Resembles WinForms or VB Name all the UI controls Implement handlers for control events in codebehind Write code to populate the named controls
Demo Build a Simple Mapping App
Traditional Approach - Drawbacks
Can it be tested? Can it be maintained? Can the UX design evolve (Blendability)? Tightly coupled UI implementation (presentation + behavior)
User Interface
Model
Introducing the MVVM Pattern
Separate the UI into two components
Model the business logic of the application View the visual, what you see ViewModel drives the user experience, supports the view
Commands
View
DataBinding
ViewModel
Model
Demo Simple Mapping App Revisited
MVVM Implementation
ViewModel implements INotifyPropertyChanged View binds to properties on the ViewModel View executes methods on the ViewModel (Commanding) View and ViewModel are connected, usually through the Views DataContext
MVVM Advantages
Maintainability Testability Designability Decomposition
MVVM Organizes the Team
UX Designer
Developer
View
ViewModel
Model
Graphic Designer
Test Engineer
Questions?