2. A pattern that describes how UI components
interact with other application code.
Associated with Microsoft XAML platforms
(Silverlight, WPF)
MVVM is not complicated, really!!!, simple is
good.
3. Not a framework nor an implementation, just a
reusable solution to a commonly occurring
problem.
May not apply to every application type, only you
can determine that for your application type.
MVVM is not required for Silverlight and MVVM,
but can help where applicable.
It should not slow down development. If it does,
re-factor your approach, something else is off.
4. Separation of concerns
◦ Each component has a specific role. UI Code is not
mixed with Business logic.
Natural Patterns for XAML Variants
◦ Microsoft’s XAML is designed with MVVM support in
mind (Key Enabler: DataBinding).
Enables Developer-Designer Workflow
◦ For some shops, this is long time overdue
◦ XAML/Expression/Other = Designer, Code=Developer,
XAML+Code=Integrator
Better Testability
◦ User Interface Business Logic can (and should) be tested.
Leave UI Component testing to Microsoft or Third Party
Component Vendors.
5. MVVM Components
◦ Model
◦ View
◦ ViewModel
Each serves a distinct and separate role.
Components are decoupled from each other:
◦ Allowing for components to be swapped
◦ Allowing internal implementation to be changed without
affecting the others
◦ Allowing components to be worked on independently
◦ Enabling isolated unit testing
6. Business Logic and Data
◦ Business Objects, Services, Data Access Layers.
Implements Change Notification for
properties.
◦ INotifyProperyChanged – Individual Property
◦ INotifyCollectionChanged – Collections
Include ObserableCollection in your daily routine.
Responsible for Model-level validation
◦ IDataErrorInfo
Independently Unit-Testable Code.
7. Defines the User Interface Elements (What the
user sees and interacts with)
◦ UserControl, Form, Window, DataTemplate
Could be a top level component or a sub-
component
◦ Custom Controls, Multiple Tabs, Wizard
May have some code-behind.
DataContext is the ViewModel
Controls bind to ViewModel Public Properties
Behaviors can invoke ViewModel Public
methods.
8. Responsible for UI Logic and Data for View
Layer of abstraction between View and Data
Model.
Can expose ICommand for Views
Public Methods are usable by View Behaviors
Uses DataBinding to maintain and
communicate state with the View.
Implements Change Notifications.
Independently Unit-Testable Code