-1

One of the client for whom I had worked has a MVVM architecture for web application.I dont know why they incorporated instead of MVC. is this a feasible idea because as far as I have gone through all MVVM tutorials if they are concerned with XAML or WPF ,they are going for MVVM.Can anybody explain in detail ?.

  • It already is. Have a look at Angular 2 and Aurelia. – Robert Harvey Jan 24 '17 at 14:46
3

According to this there are people other than your client using MVVM for web applications so at least we know he/she/they is/are not crazy :D.

Jokes aside in MVVM you have:

  1. A Model which is either a domain model and represents state content or data content (as in this grid is filled with data from that table)

  2. A View which is the same as in MVC and MVP patterns and deals with how the data is presented to the user.

  3. A View Model which access the data and expose it properties and keeps the business logic away from the view (instead of programming events directly in the Code Behind we now have Commands in our View Model)
  4. Finally there's a binder component which mediates between the view and the view model and (hence the "Data Binding" thingy).

That translates into theWPF world as:

  1. EF or your favorite ORM.
  2. XAML.
  3. Your ViewModel class with a lot of support from it's friends in System.ComponentModel and System.Windows.Data.
  4. XAML again (everytime you type {Binding Whatever}) and a bunch of classes from System.Windows.Controls and such that deal with all the "Data Binding".

How do we go from here to the web? The good people of Microsoft explained that MVVM and MVP are not that different but

whereas the MVP pattern is best suited to traditional server-rendered Web pages and the request/response paradigm, the MVVM pattern is optimized for stateful rich client applications where client-side business logic and application state is maintained through user or service interactions

So does that means MVVM is meant to deal with an stateful environment while others like MVP are meant for stateless?. Back in the day I assume that something alike was said by some hard core Smalltalkers when someone suggested to use MVC for developing web applications and we all know how that argument ended.

As far as I'm aware there are some web related frameworks already using MVVM (actually they're using Model View Binder but you know, potato, potato) like Knockout.js, also many AngularJS users are knowingly or not doing some kind of MVMM too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.