MVVM tend to be a very pleasant pattern for rich internet applications. After working with Silverlight for a while I feel this pattern is a great pattern, is much easier to work in compare to MVC but has almost all of the benefits. However, the whole MVVM pattern becomes possible because there are such wonderful binding capabilities in xaml.
Here is the big picture: Lets have a bunch of WCF services that return JSON objects. Same as when you work with WPF or Silverlight (but services are configured to return JSON instead of binary). On the view end, we have the normal ASP.Net web form which consist of only following controls: A XMLDataSource and a bunch of DataBound controls. All the controls in the web form are bound to the XMLDataSource. We have our View and Model handy, but the missing part of the puzzle is ViewModel and binding it to the View.
1- Loading model from the Service (jQuery does this)
5- Implement the Command pattern with jQuery.
6- Develop a pattern for binding nested views (Possibly a bootstrapper to load up ascx controls in AJAX placeholders).
By sorting the above problems out, we can have a pretty feasible and powerful MVVM pattern for web forms which is much nicer to implement than MVC and much more sensible than Web Forms. There would be still limitations such as binding controls together, but we can live without them.
I am not going to start this project anytime soon, but I will be really happy if some of you take this idea and start something.
March 30, 2011 at 8:16 am
Thanks for your advice.
Can I have your code please?
I never finished the code 😦
June 7, 2011 at 3:04 pm
Script# – some man did have the guts to make GWT in a C# version. Nikhil Kothari, in fact.
Knockout – it is a JS library that allows xaml-esque binding syntax to html. It’s probably one of the fastest growing JS libraries out there right now. It is written by Steve Sanderson, another great guy on the ASP.NET team.
Interesting stuff. Thanks for sharing. With all the HTML5 stuff a really good binding engine for JS is necessary.