2

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!!!

Hossein Narimani Rad
  • 31,361
  • 18
  • 86
  • 116
kidgu
  • 413
  • 1
  • 8
  • 18
  • What is the responsibility of this Messenger class? – Ravi Y Dec 28 '12 at 04:32
  • 1
    @ryadavilli To facilitate communication between View Models – Tilak Dec 28 '12 at 04:35
  • 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 Dec 28 '12 at 08:01
  • ya, ViewModelLocator,ServiceAgent are also there... – Dhaval Patel Dec 28 '12 at 18:52

2 Answers2

1

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).

Community
  • 1
  • 1
Tilak
  • 30,108
  • 19
  • 83
  • 131
  • Thak Tilak! I have already read that discussion (What framework for MVVM should I use?). It's interesting and of course each one will have pros & cons. But, here, I would like build it from scratch. The reason is I want to keep it as simple as possible, but still have mvvm philosophy. – kidgu Dec 28 '12 at 04:53
  • 1
    I have used MVVMLight and it is very cool. You can build from scratch but that is not necessary – Tilak Dec 28 '12 at 04:55
0

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.

Jviaches
  • 826
  • 3
  • 14
  • 30
  • 1
    I agree with you. I did try to use a Mvvmlight. It is really cool & useful, because I can join & understand quickly the mvvm model (with the project template, item template) & all pre-defined functionality (messenger, viewmodelbase), it make everything become more simple to start. But as you said do it by ourselves will force us to go deeper & specially I dont want to depend on any third-party framework on my application. – kidgu Dec 28 '12 at 05:40