Home » Silverlight » A Quick Intro to MVVM

A Quick Intro to MVVM

A quick view to Model–View–X  Paradigm

  • Model-View-Controller (MVC) – 1979
  • Model-View-Presenter (MVP)
  • Presentation Model (PM) by Martin Fowler – 2004
  • Model-View-ViewModel by John Gossman – 2005
  • Prism 1.0 : Composite Application Guidance for WPF – Jul 2008
  • Prism 2.0 : Composite Application Guidance for WPF/Silverlight – Feb 2009

Data Binding in WPF and Silverlight

  • ž     Bind anything to anything
  • ž     Convert types within bindings
  •         Markup based language for expressing bindings

Model-View-Viewmodel pattern

Benefits of MVVM

  • Separation of Concerns
  • —Modularity
  • —Loose Coupling
  • žEmpower Designer
  • žTestability
  • žLess Code
  • žReuse to other Platforms


žNavigation / View Management
—Mediate Pattern – Driver, Controller, Presenter, View Manager
žException Handling
—Where to handle? View or ViewModel?
—Mediator, Events, Interfaces, DataBinding
žPossible Work around:
—Messenger – The Messenger class is a lightweight way of passing messages between various ViewModel objects who do not need to be aware of each other. This is based on the Mediator implementation created by Marlon Grech and Josh Smith, as seen on Marlon’s blog (http://mvvmfoundation.codeplex.com/ )
MVVM – Misconceptions
  • žNo Code-behind
  • žViews have to be DataTemplates
  • žConverters are not needed
  • žViewModel completely wraps Model
  • Only Big projects need to implement MVVM


žModel-View-ViewModel helps you and your customers to build better apps
  • —Unit testable
  • —Maintainable
  • —Better user experience
  • —Lower costs


   ○MVVM for WPF by John Gossman http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

Your Comments are always welcome

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s