Saturday, January 01, 2011

“Simple MVVM Toolkit for Silverlight” v1 Release

Tony Sneed's Blog - Life Just Got Easier: Simple MVVM Toolkit for Silverlight

“If you’ve made a decision to start using the Model-View-ViewModel pattern (abbreviated as MVVM) for Silverlight development, you’re faced with a rather steep learning curve and a scarcity of of accepted standards and best practices.  I’ve read no less than three Silverlight books. All of them have a chapter on MVVM, in which the pattern is explained and some fairly basic examples are provided.  But when it comes to taking on some controversial issues, such as how to display modal dialogs, they tend to sidestep the issue and recommend that you pick up an MVVM toolkit.

The approach of these authors reflects the reality that a) there is more than one way to do MVVM, and b) you should not attempt to build a serious MVVM app without the aid of a toolkit.  The problem is that, if you are coming up to speed on MVVM, learning the ins and outs of a particular toolkit can be daunting…

Rather than shying away from some of the more controversial aspects of MVVM, I’ve decided as much as possible to address them directly.  Much of it boils down to your needs and preferences. A good example is going for zero (or almost zero) code-behind.  That might be a laudable goal if you have a team of visual designers using Blend that must be able to work independently from developers.  I’ve found, however, that many shops have developers building the UI.  In this case, achieving zero code-behind results in greater complexity and lowers developer productivity.  …

Another topic where there are diverging opinions is on how to communicate between various components, such as between the view and view-model or among view-models.  One approach is to use a message bus of some sort.  While that does make sense in many scenarios, especially communicating among view-models, I felt that a simpler approach using events is more practical and easier to use. …

Another area where there are different approaches concerns the use of commands.  Many MVVM toolkits include a delegating command which is used by the view-model to expose a command property that an element such as a button can bind to, so that the click event results in calling a method wired up to the command.  My personal feeling is that using commands for every button click (or other events by means of an event-to-command behavior) requires a lot of extra code in the view-model that is basically unnecessary. …

pagespap…”

CodePlex - Simple MVVM Toolkit for Silverlight - Simple MVVM Toolkit v1

“…

Release Notes

The download simply consists of a zip file, which contains the following folder structure:
Toolkit
- Helpers
- Snippets
- Templates
Samples
- SimpleMvvm-Main
- SimpleMvvm-Other
Misc
- Images
- Template Files

…”

How else to start off the year than with a MVVM post! lol Anyway… What caught my eye was the pragmatic approach Tony, and this toolkit, take. It feels very “real world” and “man, I just need to code this beast, can we leave the ‘religious’ arguments aside for now?”

One day my guess is that there will be an “official in-the-VS-box MVVM implementation from Microsoft, but until then, and even then, these kinds of toolkits/frameworks and their author’s approaches are interesting to watch…

 

Related Past Post XRef:
The MVVM Framework Tour – This time, Silverlight styling!
A MVVM framework “…three hour tour…”

A short diagramed guide of a few Model-View-* patterns

How about some free MVVM training/hands on/walkthroughs right in the VS box? “In the Box – MVVM Training” from Karl Shifflett (Oh yeah, with some WPF, Test, Moc, and Prism too)
One man’s introduction to MVVM with Visual Basic story OR zomg a MVVM article that’s not in C#!
MEF’ing in VB and SilverLight 4, with a little MVVM thrown in for flavor, from Glenn Block
SilverLight 4, RIA Services, MEF and MVVM, oh my… A four part series from the mind of Shawn Wildermuth (updated for VS2010/SL4 RTM)
MVVM Explained
The MVVM Framework Tour – This time, Silverlight styling!
A MVVM framework “…three hour tour…”
From code-behind to MVVM in 90 Minutes - Jason Dolinger on MVVM
The WPF Starter Kit – A simple, barebones, pick it up in an afternoon, MVVM/Navigation/Commanding Framework
M-V-VM for… um… busy developers (not dummies… not dummies… okay, so I’m a dummy! ;)

3 comments:

Anonymous said...

Thank you! I need something like this that is not so strict as to make my job that much more difficult.

Jaans said...

Be sure to also look at BXF (Basic Xaml Framework) from fellow MVP Rockford Lhotka. It too is an "only what's essential to MVVM" and includes an excellent Video introducing it (see link on CodePlex site).

Ps: Just because it he uses it with CSLA, doesn't meen it requires it. On the contrary, it supports various themes for the M (Model) and VM (ViewModel).

http://bxf.codeplex.com/

Tony Sneed said...

Hello Greg,

Thanks for plugging my Simple MVVM Toolkit http://bit.ly/simplemvvm on the day of it's birth on Jan 1st. I've done a lot of work on it over the past two months, rounding out the feature set and providing support for Silverlight, WPF and Windows Phone 7:
http://blog.tonysneed.com/2011/02/04/simple-mvvm-toolkit-feature-rich-with-wpf-and-wp7-support

By the way, I'm originally from So Calif and have family in Thousand Oaks and Simi Valley. Sometimes I'll present a topic for the LA .NET Dev Group. Great to connect with you sometime.

Cheers,
Tony