SlideShare a Scribd company logo
Understanding The MVVM Pattern (TechDays Belgium)
Understanding the
MVVM pattern
Laurent Bugnion
Senior User Experience Integrator
IdentityMine
http://[blog|www].galasoft.ch
What is MVVM?

 • A weird acronym
   • Model – View – ViewModel
   • « MVVM in a SLOOB with SLUT »


 • Woven into WPF/SL
 • Some confusion:
   • MVVM is really just the pattern
   • The rest are helpers, practices, etc
The MVC pattern




                  Model                View




                          Controller
The Passive View pattern




                 Model                  View




                           Controller
The Presentation Model pattern




                 Model                  View

                                        DataBinding


                         Presentation
                            Model
                         (ViewModel)
Blendability

  • Testability, Maintainability, Blendability

  • “The ability to be edited in Blend”

     • (and Visual Studio designer…)

  • Differentiate code in design and runtime

  • Create design time data
Hello MVVM (and Hi Blend)
Bridging the gap


                            View


                   DataBinding      Commands   Messages




                             ViewModel




                            Model
Bridging the gap

                                                View


            View
                            Messages       ViewModel


         ViewModel
                                         View

                   Messages
                   + callback

                                       ViewModel
Commands

 • “Point of entry” for a method”

 • Can be data bound

 • ICommand interface

   • Execute method

   • CanExecute method

   • CanExecuteChanged event handler
Commands
and RelayCommands
RelayCommands


  RelayCommand MyCommand
    = new RelayCommand(
      () => ...,
      () => true | false);

  RelayCommand<T> MyGenericCommand
    = new RelayCommand<T>(
      p => ...,
      p => true | false);
Messaging

 • Should be simple by default

 • Possible to open filtered channels

    • To a target Type (or an Interface)

    • With a Token

    • With various Messenger instances

 • No constraints at all
Messaging
Messaging


  Messenger.Default.Register<T>(
      this,
      p => DoSomething(p));

  Messenger.Default.Send<T>(p);
MVVM Light Toolkit

  • “Breaking the monotony”

  • http://www.galasoft.ch/mvvm/getstarted

  • http://mvvmlight.codeplex.com

  • V3 released at MIX10

  • Keep it small
  • Keep it simple
MVVM Light Libraries V3

  • ESSENTIALS
    • RelayCommand
    • Messenger
    • ViewModelBase
  • EXTRAS
    • EventToCommand
    • DispatcherHelper
MVVM Light Tools V3


 • Project templates (VS + Blend)


 • Item templates (VS + Blend)


 • Code snippets
MVVM Light Toolkit,
Unity,
Blendability
Flaws of MVVM

  • Too much code needed
    • INotifyPropertyChanged
    • Commands
  • Some operations are tricky (set focus…)
  • Not applicable to ASP.NET, etc
  • Message to community is not clear
Debunking the myths

  • “No code in the code behind”
    • “If you put code in the View's code-behind, the
     MVVM police will take your family away”
    • “No need for converters”

  • “MVVM is only suitable for big projects”
  • “MVVM costs performance”
  • “MVVM is complex / makes my head hurt”
Debunking the myths

  • “I don’t need separation because I don’t
   have a designer”
  • “You cannot use MVVM with other
   patterns”
  • “MVVM will make you rich and attractive”
MVVM on the
Windows Phone 7
http://blog.galasoft.ch
http://www.galasoft.ch/mvvm/getstarted
@LBugnion

More Related Content

What's hot (18)

PPTX
MVVM with WPF
S V
 
PPTX
Training: MVVM Pattern
Betclic Everest Group Tech Team
 
PPTX
XAML/C# to HTML5/JS
Michael Haberman
 
PPTX
Learn skills technologies
s_shankar1977
 
PPTX
Migrating MVVM Applications to HTML5
Chris Bannon
 
PPTX
Introduction to Umbraco
Giuseppe Marchi
 
PPTX
[Mas 500] Web Basics
rahulbot
 
PPTX
JavaScript Framework Smackdown
meghantaylor
 
PDF
MVVM Light Toolkit Works Great, Less Complicated
mdc11
 
PDF
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 2...
WebStackAcademy
 
PPT
MVVM frameworks
Egor Bogatov
 
PPTX
A Smooth Transition to HTML5 Using MVVM
Chris Bannon
 
PPTX
MVVM with Kendo UI
Bruno Pessanha
 
PDF
Gemeinsame View-Models mit XAML Technologien
Christian Nagel
 
PPTX
MVVM Windows UWP apps with Template 10
Jiri Danihelka
 
POT
Beginning In J2EE
Suthat Rongraung
 
PPT
Javascript(2)
tomcoh
 
ODP
A Good PHP Framework For Beginners Like Me!
Muhammad Ghazali
 
MVVM with WPF
S V
 
Training: MVVM Pattern
Betclic Everest Group Tech Team
 
XAML/C# to HTML5/JS
Michael Haberman
 
Learn skills technologies
s_shankar1977
 
Migrating MVVM Applications to HTML5
Chris Bannon
 
Introduction to Umbraco
Giuseppe Marchi
 
[Mas 500] Web Basics
rahulbot
 
JavaScript Framework Smackdown
meghantaylor
 
MVVM Light Toolkit Works Great, Less Complicated
mdc11
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 2...
WebStackAcademy
 
MVVM frameworks
Egor Bogatov
 
A Smooth Transition to HTML5 Using MVVM
Chris Bannon
 
MVVM with Kendo UI
Bruno Pessanha
 
Gemeinsame View-Models mit XAML Technologien
Christian Nagel
 
MVVM Windows UWP apps with Template 10
Jiri Danihelka
 
Beginning In J2EE
Suthat Rongraung
 
Javascript(2)
tomcoh
 
A Good PHP Framework For Beginners Like Me!
Muhammad Ghazali
 

Similar to Understanding The MVVM Pattern (TechDays Belgium) (20)

PPTX
Advanced MVVM in Windows 8
Gill Cleeren
 
PDF
MVP Mix 2015 Leveraging MVVM on all Platforms
James Montemagno
 
PPTX
MVVM and Prism
Bilal Ahmed
 
PPTX
Adopting MVVM
John Cumming
 
PDF
An introduction to knockout.js
Emanuele DelBono
 
PPTX
JavaScript TDD
Uri Lavi
 
PPTX
MVVM for Modern Applications
Jeremy Likness
 
PPTX
Building an enterprise app in silverlight 4 and NHibernate
bwullems
 
PPTX
Windows Phone App with MVVM design patten
Kamalakannan Annamalai
 
PPTX
Prism library and MVVM
Jiri Danihelka
 
PPTX
WPF For Beginners - Learn in 3 days
Udaya Kumar
 
PPTX
Modern ASP.NET Webskills
Caleb Jenkins
 
PPTX
Applied MVVM in Windows 8 apps: not your typical MVVM session!
Microsoft Developer Network (MSDN) - Belgium and Luxembourg
 
PDF
jQquerysummit - Large-scale JavaScript Application Architecture
Jiby John
 
PDF
MVVM in iOS presentation
G ABHISEK
 
PDF
Model View Madness
Mike Wilcox
 
PPTX
Mobile App Architectures & Coding guidelines
Qamar Abbas
 
PPTX
Building databound JavaScript apps with Knockoutjs
Nish Anil
 
PPTX
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
Flavius-Radu Demian
 
KEY
Sugarcoating your frontend one ViewModel at a time
Einar Ingebrigtsen
 
Advanced MVVM in Windows 8
Gill Cleeren
 
MVP Mix 2015 Leveraging MVVM on all Platforms
James Montemagno
 
MVVM and Prism
Bilal Ahmed
 
Adopting MVVM
John Cumming
 
An introduction to knockout.js
Emanuele DelBono
 
JavaScript TDD
Uri Lavi
 
MVVM for Modern Applications
Jeremy Likness
 
Building an enterprise app in silverlight 4 and NHibernate
bwullems
 
Windows Phone App with MVVM design patten
Kamalakannan Annamalai
 
Prism library and MVVM
Jiri Danihelka
 
WPF For Beginners - Learn in 3 days
Udaya Kumar
 
Modern ASP.NET Webskills
Caleb Jenkins
 
Applied MVVM in Windows 8 apps: not your typical MVVM session!
Microsoft Developer Network (MSDN) - Belgium and Luxembourg
 
jQquerysummit - Large-scale JavaScript Application Architecture
Jiby John
 
MVVM in iOS presentation
G ABHISEK
 
Model View Madness
Mike Wilcox
 
Mobile App Architectures & Coding guidelines
Qamar Abbas
 
Building databound JavaScript apps with Knockoutjs
Nish Anil
 
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
Flavius-Radu Demian
 
Sugarcoating your frontend one ViewModel at a time
Einar Ingebrigtsen
 
Ad

Recently uploaded (20)

PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
PPTX
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
PPTX
Wondershare Filmora Crack Free Download 2025
josanj305
 
PPTX
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
PDF
Proactive Server and System Monitoring with FME: Using HTTP and System Caller...
Safe Software
 
PDF
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
PDF
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
PPTX
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PDF
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
PPTX
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
PDF
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
PDF
Optimizing the trajectory of a wheel loader working in short loading cycles
Reno Filla
 
PDF
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
Wondershare Filmora Crack Free Download 2025
josanj305
 
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
Proactive Server and System Monitoring with FME: Using HTTP and System Caller...
Safe Software
 
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
Kubernetes - Architecture & Components.pdf
geethak285
 
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
Optimizing the trajectory of a wheel loader working in short loading cycles
Reno Filla
 
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
 
Ad

Understanding The MVVM Pattern (TechDays Belgium)

Editor's Notes

  • #9: Demo of connection to WCF service, fails in BlendShow how to attach to processIdentify problemIsInDesignMode
  • #13: Demo of connection to WCF service, fails in BlendShow how to attach to processIdentify problemIsInDesignMode
  • #16: Demo of connection to WCF service, fails in BlendShow how to attach to processIdentify problemIsInDesignMode
  • #21: Demo of connection to WCF service, fails in BlendShow how to attach to processIdentify problemIsInDesignMode
  • #25: Demo of connection to WCF service, fails in BlendShow how to attach to processIdentify problemIsInDesignMode