What is the difference between MVVM Light and MVVM?
Asked Answered
L

5

5

I've been programming my Windows 8 apps and Windows phone apps using MVVM. I'm about to be exposed to MVVM Light and I was just wondering what the difference between them are? I imagine MVVM light is a sandboxed version of MVVM that comes with WPF and WinRT/WP8 development.

Is there a simple answer? Why would one choose MVVM Light over MVVM?

Liggitt answered 20/3, 2013 at 15:41 Comment(0)
C
16

There is no such thing as "MVVM full".

MVVM is a pattern on how to structure your UI and data and business logic.

MVVM light is a lightweight framework that supports you in implementing the pattern.

BTW: Hovering over the tags you used in your question will also answer this ;-)

Commissioner answered 20/3, 2013 at 15:43 Comment(6)
Ok, Maybe I'm not asking the right question. I guess I'm still wondering why then would someone use MVVM Light? I understand it is supposed "help" get you started. But then once you are started do you continue using it? Or just switch to what MSFT provides.Liggitt
What do you actually mean when you say "what MSFT provides"? MVVM light basically contains a base class that implements INotifyPropertyChanged along with some helper methods. Additionally, it includes a pub/sub implementation. It is not supposed to help you get started. It is supposed to reduce the development time by containing parts you would have to implement anyway.Commissioner
So basically instead of writing everything on my own there are helper methods that does some of it for me.Liggitt
Precisely, this is the intent of MVVM Light, to facilitate the development by "breaking the monotony" of having to write everything yourself. Nothing more nothing less :)Cerallua
Could anybody tell me where I can find the documentation for MVVM Light? For example, I want to know what are the events that MVVM Light support? How can I figure that out?Shahjahanpur
There is some info her mvvmlight.net/doc or here pluralsight.com/training/Courses/TableOfContents/…Commissioner
C
3

MVVM Light is intended as a toolkit (not a framework ;) that provides a suite of components that help you when writing applications according to the MVVM pattern. For example, MVVM Light has a few library classes that encapsulate code that is repetitive, snippets to speed up and facilitate the typing, project and item templates to speed up the creation of new applications and avoid losing time with the basic "wiring" of the app, etc.

Cerallua answered 20/3, 2013 at 16:54 Comment(0)
C
1

MVVM stands for ModelViewViewModel.

MVVM Light is a made up thing from "Laurent Bugnion" - GalaSoft

http://mvvmlight.codeplex.com/

MVVM is an enterprise application development pattern,a best practice. We can deep dive in by following page.

http://msdn.microsoft.com/en-us/library/gg405484(v=pandp.40).aspx

If you would like to do whole business dedicated. Independent from User Interface elements such as silverlight TextBox, we need to apply MVVM pattern. By this way we reuse business part for other client platforms. Such as Windows Phone ..

If you know MVC you can resample Controller to ViewModel but this ViewModel does not contain any reference of objects in your view. And your VM may abstract your View.

I think an MVVM pattern applier for .NET should be aware of these technics; Commanding, CollectionViewSource for filtering sorting operations, DataContext, Binding, INotifyPropertyChanged

Crain answered 20/3, 2013 at 16:55 Comment(0)
V
1

One way I have been using both (distinctly) - MVVM is a design pattern which I have simply used to architect my code as per the patterns - so in essence MainWindow.xaml sits in View Folder, MainWindow_ViewModel.cs sits in VM folder and then there is Model.cs which sits in my Model folder. DataContext of the View is set with ViewModel class for wiring. Ofcourse MVVM is not just file organization but ensuring the code is written as per the pattern too (separation of logic and all the nice stuff which should be implemented as per the pattern). Doing this - doesnt necessarily need me to reference MVVM Light libraries to do the above.

I specifically use MVVM Light when I want to have communication between multiple ViewModels using the Messenger.Default.Send (to broadcast the value) Messenger.Default.Register (to get the value in a different VM)

Can share sample code if necessary. Hope that helps.

Volunteer answered 20/3, 2013 at 17:6 Comment(0)
G
1

MVVM Light is a toolkit for the MVVM pattern developed by Galasoft. Thus MVVM is a design pattern and MVVM Light helps you to put it to practice.

Gapin answered 28/2, 2019 at 13:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.