I hate wasting time - life’s too short to do everything on your own, that’s why I re-use whatever’s worth re-using. Sometimes licensing costs may be a problem, but usually it’s not that hard to find something for a reasonable price. My latest hunt was for MVVM framework for Silverlight.
For those who don’t know what is MVVM and why should I bother with that if I can make an application in a traditional way - please check the following links out:
- isolate View from ViewModel (using Dependency Injection)
- make some smart binding (not only on data level, but also on command level)
- completely avoid code-behind in Views
- create a modular solution (like an app-hub for plug-inable functionality)
- Cinch V2 - http://cinch.codeplex.com/
- MVVM Light - http://mvvmlight.codeplex.com/
- Caliburn - http://caliburn.codeplex.com/
- It’s available on NuGet :)
- It’s based on “convention over configuration” paradigm! For instance, every view model is automatically bound to its view(s) by name and if you bind properties in your XAML, Caliburn.Micro will look for corresponding properties in your ViewModel. Easy peasy.
- It provides some neat helpers - like based classes for ViewModels and INotifyPropertyChanged implementations.
- It supports MEF “by design”. Yes, I’m a MEF-addict.
- Even if it’s so tiny, it supports WPF, Silverlight and WP7 as well!
- It introduces few interesting concepts like: coroutines, conductors and activation. You can read up and make your opinion on those concepts here: http://caliburnmicro.codeplex.com/documentation
- It allows you to extend conventions! So, if you’re gonna use external vendor controls (for example: Telerik), you’ll be able to add some additional convention rules, so binding to them will be as easy as binding to default Silverlight controls.
- It’s missing some functionality present in “bigger” frameworks - for instance: ViewModel validation support
- Convention over configuration works nicely as long as you work with Microsoft controls or other controls inherited from Microsoft controls. In other cases either you’re going to be more messy or you prepare your own convention rules (but that requires some bigger effort) - there’s a package for Telerik controls on NuGet, but it has plenty of flaws (sadly)
- If you go too deeply in “convention over configuration” your code may (surprisingly) become less clear and harder to debug
- Documentation is very sparse and incomplete