2
votes

I have investigating about MVVM for less than a month. I have also tried a Mvvm framework (Mvvmlight from Laurent Bugnion. It's awesome).

But I am thinking about doing all these stuffs by myself, it means I want to build my project follow mvvm philosophy from scratch (don't use any mvvm framework available). I want to make it as simple as possible but still have enough functionality and strictly follow mvvm philosophy. That's why I need your advices to help me recognize what I need & what I face & how much time it'll take me?

In almost Mvvm framework, I found they support something belows:

  • Build a ViewModelBase: which should Implement for INotifyPropertyChanged, INotifyPropertyChanging -> Support for Binding Properties
  • RelayCommand (in Prism it is DelegateCommand): implement for ICommand
  • Messenger class

Is it enough to make a Mvvm project?

I know that Mvvm is a model, so there are diverse ways to implement. But with a newbie like me. It's too difficult to know where I should start from. I'm sorry for a long story but not clear question. Just I try to show my current situation and Ask for advices from you all.

Thanks for your reading & Happy upcoming new year!!!

2
What is the responsibility of this Messenger class? - Ravi Y
@ryadavilli To facilitate communication between View Models - Tilak
About Messenger in mvvm, I think it is very useful for communication between views & view-models mutually and ensure not to use view's components inside ViewModel. But, is there anyone who know a good example to start to develop a Messenger class? - kidgu
ya, ViewModelLocator,ServiceAgent are also there... - Dhaval Patel

2 Answers

1
votes

For simple MVVM projects following are sufficient
1. RelayCommand : For custom commands
2. Messenger (or EventAggregator or MessageBus) :For communication between view models
3. ViewModelBase :Base class for ViewModels. Can also be used as base class for Models (but for that separate base class)

For larger application, Layout support is also needed. This is provided by Prism Regions concept.

Other than that you are good to go.

I would however recommend to use existing MVVM framework. Have a look at this for commonly used MVVM frameworks. They are tried and tested framework (and free). It requires lots of testing effort to build SOLID framework.

I will not say building a framework is big effort, but whatever it is, it is totally unneccesary (until Business/Work environment is very strict and does not allow it).

0
votes

I think that it it important (for first time at least) to implement MVVM design pattern by yourself without using any external MVVM frameworks. It will force you to see and to understand "underwater stones" and different approaches and solutions to solve then.