tags:

views:

164

answers:

5

i took a look at some questions here at stack overflow like this & mix10 building your own mvvm framework

i wonder if as a beginner its better to start from scratch (but i heard from the vid, its not recommended) or use a framework

also which is more suited as a beginner framework to learn? i find that after reading quite a few articles or even tutorial videos i am still quite lost. i may get parts here and there but still not there.

caliburn micro a smaller framework easy to learn? or something from microsoft like MVVM toolkit or Unity/Prism (whats the diff bet all this MS frameworks btw)? MVVM Light?

+4  A: 

My $0.02 :

I've started using WPF / the Mvvm-pattern a few weeks ago and one route I can definitely recommend is first starting a test-project, reading a lot about mvvm, and trying to implement it yourself (even if it's just by using parts of other people's stuff). Implement something, read some more, go back and change stuff, and then read some more.

Do this for the first 2 weeks and you'll get an idea of what it's actually all about, you'll see some problems and find some solutions, etcetera. Basicly this will get the mvvm-idea in your fingers and give you some hands-on experience.

Then if you like you can throw away your test-project, decide wether or not to really start writing your own stuff or using an existing kit, and probably have more appreciation and understanding for the way existing kits work.

I ended up not using an existing kit but my own very simple implementation since I didn't need much complexity for my project, but I did get a lot more appreciation for some implementations I've seen discussed on the interwebs.

Edit: When I talk about "two weeks" I mean "two weeks of sparetime" which is about 25 real hours ;-)

IUsedToBeAPygmy
i think i spent quite abit of time, i think abt 3 days (~= 24hr!!! oh i am quite a fail)? quite full days ... but havent gotten much ... yes i did try out caliburn micro with their intro hello world app, successfully ... stuck at their MEF part ... viewed quite a few videos. even prism ones and still confused ...
jiewmeng
That's exactly why I recommend not starting with a framework.These frameworks can be very overwelming because of their sheer size and feature-list. If you don't have experience with MVVM you probably won't understand what 99% of these features are for.If you start writing a very simple MVVM implementation yourself you will meet certain problems and you'll learn about different ways to approach them.This way you'll learn so after a while the frameworks won't be black magic anymore - and then you can consider continuing to build your own system or switch to an existing framework.
IUsedToBeAPygmy
+5  A: 

IMO, there no need to use a framework. MVVM is just a way of doing things.

For a start, you only need a RelayCommand class, so you can bind commands to your viewModel. You can download it from Josh Smith MVVM Foundation

Then when you are more advanced you can add other classes like:

  • ObservableObject: This is intended to be the base class for ViewModel types, or any type that must provide property change notifications. It implements INotifyPropertyChanged and, in debug builds, will verify that all property names passed through the PropertyChanged event are valid properties. This class used to be called ViewModelBase.

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

Eduardo Molteni
A: 

I think it will be better to start with a hello world application. Slowly get acustomed with the controls (listview, gridivew...) and then basic wpf concepts (binding, templates, triggers...). After that you can move on to MVVM.

Sathish
+2  A: 

From my point of view, If you are learning WPF/MVVM for yourself then you must learn MVVM thoroughly and try to build a framework from scratch(As explained by Eduardo)

But if you are starting with a Commercial project or Enterprise application then you must consider using some established framework like PRISM or Caliburn or MVVM Light Toolkit.

We had not used any framework in my first project and I somewhat regret that. Although nothing went wrong and it was not very tough to build your own framework(as Eduardo said) but it took us alot of time and a no. of iterations in finalizing various base classes etc. Also, we couldn't take the advantage of various things which are already implemented in some of these frameworks(as we didn't knew about them at all).

akjoshi