tags:

views:

7067

answers:

10

I am developing an application with the MVVM model, but I have reached a point where I need to choose which framework to use.

Among the possible options are:

  • MVVM Toolkit
  • MVVM Foundation
  • WPF Application Framework (WAF)
  • Light MVVM
  • Caliburn
  • Cinch
  • Prism

In your experience, which is better?

+59  A: 

It really depends on what you are trying to achieve, and how much infrastructure you want in place already, plus the ease with which you can find samples that help you out. I'm going to declare an interest here, because I've been actively involved in at least one MVVM framework, and I've had input into others through the WPF Disciples group, so I'm a little bit biased. Saying that, here goes:

Microsofts MVVM Toolkit - this is still very much in the alpha stages. When it was originally released, it took a bit of a savaging from the Disciples because of what it didn't do. Saying that, MS is looking to beef this framework up so it's one to watch - it's just not ready yet.

MVVM Foundation - ah Josh Smith's version of the framework. Josh is one of the daddies of MVVM, and has been a huge advocate and teacher of the pattern. As a result, a lot of what you'll find in other frameworks has Josh's fingerprints all over it. This framework is intended to provide the basics of MVVM, and not to address some of the more esoteric issues. Originally this was intended only for WPF, but people such as Laurent Bugnion and myself have added functionality/projects that mean this will be a Silverlight compatible framework as well.

WAF - no experience of it, so I can't comment on it I'm afraid.

MVVM Light - Laurent Bugnion's take on it, and just updated to version 2. This is a very good framework, but again it's not intended to cover every single aspect of MVVM applications. Given Laurent's background, it has very strong Silverlight and Blendability support in it.

Update Laurent has just informed me that the .NET 3.5 and .NET 4.0 versions are feature compatible. Wau to go Laurent.

Cinch - Sacha Barber's excellent WPF only MVVM framework. This covers more ground than the frameworks I've talked about above. It's an excellent framework, and takes advantage of concepts covered in Bill Kempf's excellent Onyx project. Onyx is intended to complement MVVM frameworks, and adds in functionality that's typically been hard for people to do in MVVM/WPF. Again, originally intended to be WPF only, Onyx has progressed to include SL compatibility - work I am particularly proud to have been involved in.

Prism - Again, I've never used it, but I've heard a lot of good things about it.

Ocean - Karl Shifflett, Program Manager on the Cider team, recently released a fully featured WPF MVVM framework. Again, this is an excellent framework and has lots to recommend it.

The bottom line is, download the different frameworks take a look at them and work out which one fits most intuitively with the way you think and with your requirements. If you think that you might want to support Silverlight from the same codebase then the WPF only frameworks should be discounted.

Pete OHanlon
+1, great answer. which one you are using in your daily work?
Jirapong
I use one that we wrote, because we have very specialist needs for MVVM. It's heavily influenced by the work that Josh did, and I'll be releasing it as Open Source in the near future (I'm busy ripping out the proprietary bits). It's called Goldlight.
Pete OHanlon
Thanks, great answer.
Rangel
Along with that, what is your data access layer framework? guys.. LINQ, LLBLGen, EF, nHibernate?
Jirapong
It depends on the project and requirements. Sometimes we use LINQ, sometimes NHibernate, sometimes Castle ActiveRecord, and sometimes eXpress Persistent Objects.
Pete OHanlon
Hi Pete, just want to comment that the MVVM Light Toolkit works just the same for WPF 3.5 and WPF 4 as for Silverlight 3 and Silverlight 4. I am careful to keep the features in sync as much as I can. You are right about the blendability though, this is a major concern for me :)Cheers,Laurent
LBugnion
How is MVVM Light's blendability advantageous over the approach detailed in the ff. blog post: http://blogs.msdn.com/b/mcsuksoldev/archive/2010/08/27/designdata-mvvm-support-in-blend-vs2010-and-wpf-silverlight.aspx?
Chry Cheng
+8  A: 

Also look at:

Caliburn & Onyx!

rudigrobler
+6  A: 

I try to describe the Frameworks missing in Pete’s great answer:

MVVM Toolkit (Microsoft) is a very lightweight library with Visual Studio project templates that should support beginners with this pattern. If Microsoft gets good feedback for their Toolkit then they might implement this as a new Visual Studio (maybe 2010) project template.

Prism (Microsoft p&p) is a framework that provides more than the support for the MVVM pattern. The main goal of this project is to help you to build modular WPF and/or Silverlight applications. When you just need to implement the MVVM pattern or you are a beginner in .NET/WPF I won’t recommend this project. Note: This project uses the term PresentationModel for the MVVM pattern. But they are identical. See also: Link.

WPF Application Framework (WAF) is a lightweight framework that helps you to create WPF apps with MVVM. It’s just for WPF and so it doesn’t support Silverlight. It goes a bit another way than most other MVVM frameworks with the introduction of Controllers. They are responsible for the application workflow and they mediate between various ViewModels.

jbe
+1  A: 

Would it be fair to say that WPF Application Framework (WAF) is a lightweight version of the Composite Application Guidance (Prism) block?

Tarfa
Yes, I guess you could say that :)
Andrei Rinea
A: 

If you're looking for Extensibility (the ability to write add-ins) on top of a WPF/MVVM application framework, then you may be interested in SoapBox Core disclaimer: I wrote it. It's open sourced, so even if you don't use it, there might be some good ideas in there for you. It uses MEF for both Extensibility and IoC.

Scott Whitlock
+1  A: 

Meh. Mvvm doesn't really require an entire framework to support IMO. If you understand the concept, it's pretty straightforward to start off with a clean VM baseclass that implements INotify, and just go from there.

Pierreten
+3  A: 

my bet will be on Caliburn and MVVMlight, it seems that not many of these mvvm frameworks support silverlight. I can foresee that there will be more MVVM frameworks to choose from than the IoC frameworks, because it is harder to set up the feature boundary to the mvvm framework. I guess the best way to find out which one is better suit your project will be by listing/comparing their features.

Also check out Mix10. I learn a lot from the talk : building your mvvm framework.

MCSean
A: 

There's also nRoute

A really nice application framework for WPF/Silverlight that supports MVVM

Daniel O
A: 

All in all, I am 90% through my application and all I have used of MVVM Toolkit is the factory function that builds a command for me given a delegate function to launch in Execute. I think I could switch to any other framework or no framework in a couple of hours.

mico
+1  A: 

Mix your own!

I used EventAggregator from PRISM, with ViewModelBase from MVVM foundation and so on. I also tweaked the RelayCommand (DelegateCommand called in some places) to accept other data too, and so on.

I wouldn't recommend just one framework per se.

Andrei Rinea