locked
why MVVM? RRS feed

Answers

  • Because in building dozens of large scale line of business applications for various customers (many of them Fortune 500 companies) with teams ranging from a few developers to dozens of developes and designers, here is what we found:

    * Parallel efforts - most other patterns don't facilitate such a clean separation that truly allows developers/designers to work in parallel, other patterns require a more serial effort and thus more calendar time

    * In additon, developers can work on different sections of code independently

    * The design-time data provided by the view models allows the designers to design in their tools of choice, such as Blend, without having to consistently recompile and run the application to see the changes

    * The pattern allows for unit tests and integration tests that ensure the code is more stable before going to production

    Bottom line is we've used various patterns and MVVM always gets the job done faster and provides more stable code/less debugging and rework in the long run. Any time we've run into a shop that says MVVM is slowing them down, it's been due to lack of understanding of the pattern and misuing it. Anywhere the teams understand MVVM and XAML, it's accelerated development.

    Friday, April 22, 2011 11:47 AM
  • The best extensions to deal with MVVM is "MVVM Light Toolkit".

    I say the "best" because :

    * it is targetting only MVVM

    * it is doing well

    * it is simple to surface without hours of practice

    PRISM is a very good toolkit, serious and very complete. THe problem is that is does MVVM among a lot of other things, and it is hard to surface just to use a small part of it (most often).

    Personnaly I hate "big libs", even the best one as Prism, because technology is changing so fast that we can spend months to master a simple lib... We need little, efficient and small targetted libs. "MVVM Light Toolkit" is of this kind.

    I use it a lot, I 've trained a lot of customers to use it, and everybody is happy.

    Prism is a big machine, for big teams where some people can learn a part of it deeply, and then share their knowledge alltogether. If you're alone, forget it.

    Caliburn, Catel, Light, Cinch... forget them all. Not used a lot so no really debugged. Always dangerous to use a too few used lib to create real apps...

    So, the only choice today is : Very straight and simple to learn lib doing just MVVM (but not supplying solution for anything else) : MVVM Light Toolkit; or the Big One, Prism, strong and efficient, but hard to master quickly.

    Saturday, April 23, 2011 12:30 AM

All replies

  • MVVM

    Separates logic from the user interface (Loosly Coupled)
    Testability
    Maintainability

    Theoritically these are the words used to describe the benifits of MVVM. Let me tell you my personal experience in using MVVM.

    One thing is of course the maintainability. Say, you have a combo control, with itemssource set from code behind. I need to change it to autocomplete; This will reflect the changes in code behind as well; but when using MVVM, you will be having little to change in the business logic layer (ViewModel)

    I personally believe that we need only 3/4 th of the code that is written in the code behind when using the MVVM pattern

     

    Monday, April 18, 2011 6:56 AM
  • I'm no hardcore at UI design, but here's my opinion:


    Why MVVM?

    Because it's a pattern that fits a lot of application types very well.


    WPF made a wide range of powerful UI capabilities available.


    Play with them yourself if you please, try to find the best model for your application, and if you can't find one that fits better than MVVM would, use it.

    There's a lot of work already put behind it, and it's very cheap compared to the power it provides to the modularity of your application's UI.

    You can likely find a better pattern for your specific application with time, but that can take a real long time... which will not necessarily pay off.


    That's my experience.



    Also, on Silverlight it's a even a bit more feasible, because I believe the parts in WPF that are required to use this pattern get higher priority at porting, thus get ported earlier.




    Oh, if you've never used it, I really recommend at least learning what it's capable of.

    Monday, April 18, 2011 7:28 AM
  • the same things we can achive in a non MVVM way , like

    1-we can test our code which is getting values from our control in code behind  and saving values into data base.

    2-Seperation of UI and Logic if we need to change control we need to make changes in either way in mvvm and non mvvm way , using mvvm we need to changed just in xaml and in a non mvvm way we need to change in code behind file.

    I am not saying its useless but i am confused the same i can achieve without it and in less time so why?

    Tuesday, April 19, 2011 4:00 AM
  • Initial development might take time, but in the long run, I can assure that, it will be very helpful; but again, at times, MVVM can kill your time for simple forms. This will be useful for medium and big projects;

    Tuesday, April 19, 2011 11:17 PM
  • Hi,

    Maybe this article about Advantages and disadvantages of MVVM will give more explanation:

    http://blogs.msdn.com/b/johngossman/archive/2006/03/04/543695.aspx

    Hope this helps.

     

    Regards

    Friday, April 22, 2011 1:17 AM
  • Because in building dozens of large scale line of business applications for various customers (many of them Fortune 500 companies) with teams ranging from a few developers to dozens of developes and designers, here is what we found:

    * Parallel efforts - most other patterns don't facilitate such a clean separation that truly allows developers/designers to work in parallel, other patterns require a more serial effort and thus more calendar time

    * In additon, developers can work on different sections of code independently

    * The design-time data provided by the view models allows the designers to design in their tools of choice, such as Blend, without having to consistently recompile and run the application to see the changes

    * The pattern allows for unit tests and integration tests that ensure the code is more stable before going to production

    Bottom line is we've used various patterns and MVVM always gets the job done faster and provides more stable code/less debugging and rework in the long run. Any time we've run into a shop that says MVVM is slowing them down, it's been due to lack of understanding of the pattern and misuing it. Anywhere the teams understand MVVM and XAML, it's accelerated development.

    Friday, April 22, 2011 11:47 AM
  • How about the pattern (or framework) to build MVVM Application?

    There are so many framework on codeplex as Prism, Catel, Caliburn, Light ,Cinch....

    I feel confuse when choice among them .

    I usally work with prototype MVVM Project (by myself) .It work normally but i have to add some library from mvvm toolkit  (for relaycommand, message...)

    What the best practise of MVVM ?

    Friday, April 22, 2011 9:58 PM
  • The best extensions to deal with MVVM is "MVVM Light Toolkit".

    I say the "best" because :

    * it is targetting only MVVM

    * it is doing well

    * it is simple to surface without hours of practice

    PRISM is a very good toolkit, serious and very complete. THe problem is that is does MVVM among a lot of other things, and it is hard to surface just to use a small part of it (most often).

    Personnaly I hate "big libs", even the best one as Prism, because technology is changing so fast that we can spend months to master a simple lib... We need little, efficient and small targetted libs. "MVVM Light Toolkit" is of this kind.

    I use it a lot, I 've trained a lot of customers to use it, and everybody is happy.

    Prism is a big machine, for big teams where some people can learn a part of it deeply, and then share their knowledge alltogether. If you're alone, forget it.

    Caliburn, Catel, Light, Cinch... forget them all. Not used a lot so no really debugged. Always dangerous to use a too few used lib to create real apps...

    So, the only choice today is : Very straight and simple to learn lib doing just MVVM (but not supplying solution for anything else) : MVVM Light Toolkit; or the Big One, Prism, strong and efficient, but hard to master quickly.

    Saturday, April 23, 2011 12:30 AM
  • Thanks odahan.

    Your post is very clearly and helpful fo me- for everybody who want to work with trusted MVVM framework for longterm.

    I'm going to learn about MVVM Light deeper and then PRISM.

    Saturday, April 23, 2011 8:01 AM
  • I wrote two big papers (about 100 pages each) about MVVM principles and the second about applying MVVM with MVVM Light.

    If you can read French, then I can suggest you to get these papers (search for MVVM posts in my blog www.e-naxos.com/blog ). The blog content has a "translate to" feature, but unfortunaly the PDF papers do not have it...

    Saturday, April 23, 2011 4:28 PM