Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

I'm currently trying to get my head round MVVM for WPF - I don't mean get my head round the concept, but around the actual nuts and bolts of doing anything that is further off the beaten track than dumb CRUD.

What I've noticed is that lots of the frameworks, and most/all blog posts are from 'ages' ago.

Is this because it is now old hat and the bloggers have moved onto the Next Big Thing, or just because they've said everything there is to say?

In other words, is there something I'm missing here?

share|improve this question

closed as primarily opinion-based by gnat, MichaelT, GlenH7, Bart van Ingen Schenau, World Engineer Oct 22 '13 at 1:09

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

MVVM isn't outdated, but it was overplayed to begin with. I never liked it and it kept me in WinForms for too long; failing to see the forest for the trees, I threw the baby out with the bathwater. I get WPF now, and I get the idea of not wanting to mix code with markup, but I prefer the Android style of sticking the markup in one place and dereferencing it with casts in my code (which you can also do in WPF, even though it never got trendy to do so for whatever reason).

That way you gain more fine-grained control and don't have to worry about all the "onchanged" handling everywhere. I feel this is actually more testable because tests won't always catch it if you miss an "onchanged" event.

You lose a bit of "declarative"-ness, which seems to be a trend these days (e.g. if two widgets are mapped to the same value, in MVVM you can just do that, whereas with imperative code you have to set both individually). But even with MVVM, that only works in the menial case. If some widget has to display the log of another widget, then you've got to write another handler and another "onchanged" event and so you end up having to stretch the definition of "declarative" to say it is so.

2015 update

WPF MVVM was (r)evolutionary for its time. As was WPF. But they both had their warts. Plain WPF had too much built into it (plus it was built on XML), and was kind of a pain to deal with. (Really, if WPF had just taken a more "library" approach rather than a "framework" approach, it could have turned into some really cool stuff and the whole tech universe might be entirely different now). The idea of MVVM was great, but trying to fit an MVVM into WPF was somewhat hacky since 1) C# couldn't really express it without a lot of boilerplate, and 2) WinForms relics like modal popups were still ideologically prevalent but couldn't be easily represented in MVVM. Thus it all sucked.

That said, it's still the only realistic option on Windows when you need transparency or GPU for LOB apps.

React has of course made MVVM obsolete. I was disappointed that VS2015 didn't have a native counter to that. For now we're still stuck using raw WPF (which is OK, but feels old (really feels just as old as winforms now), and doesn't have a ton of built-in functionality (feels like some cool but abandoned project) or with-MVVM, which at this point feels like much overhead for nothing, since even good MVVM (angular 1) has been exposed for its shortcomings.

I'd avoid WPF MVVM. It's an extra layer, and nobody is caring about it anymore.

share|improve this answer
Hmm.. I realize it's partly a matter of religion, but I started out with MVVM in WPF using Cinch back in.. Mmm. 2010? And I liked it a lot. Since then I've moved on to Caliburn.Micro and Angular and still loving it - obviously, there's a lot of shortcomings in MVVM like you said (noticeably no non-hacky way to do dialogs). MVVM might feel quite verbose, but the overall readability and the explicit ui-design / implemention gap still makes it worthwhile for me. –  cwap Sep 2 at 14:02

All said and done, there is a limit to what you can do with an MVVM framework.

They are "done" since WPF has not moved on since Microsoft released it. If there were updates to the technology, the libraries would need updating too. This has not happened.

share|improve this answer
So it's WPF that is 'out of date'? Concerning your first sentence: is it that in real life UI and code are just too intertwined to make it a realistic proposition, or could some tweaks in WPF have made it the Holy Grail (or nearly?) –  Benjol May 29 '13 at 12:58
@Benjol - It does appear that Microsoft abandoned WPF (or at least, are no longer updating the technology). My point about MVVM frameworks is just that for their intended purposes there is little to continue and extend them on a stale platform. I don't know why Microsoft stopped updating WPF, but I doubt it is what you suggest - it is more likely that Windows 8 and RT took the resources away from WPF. –  Oded May 29 '13 at 14:05
This is not true. WPF has been updated several times, most recently in .NET 4.5: –  17 of 26 Aug 12 '13 at 14:56
It's also worth noting that MS supports their developer technologies forever. MFC, released in 1992, continues to get bug fixes with each release/service pack of Visual Studio. –  17 of 26 Aug 12 '13 at 14:59
I'd even go as far as claiming that the lack of recent additions to WPF is an indication of its maturity. Also, as @Oded already touches upon, desktop apps, while they still have their value, are now being replaced by mobile apps. Still, it is worth mentioning that much of what WPF started (declarative UI programming, MVVM, DependencyProperties and Data Binding) now lives on in WinRT and Web technologies (multiple JS frameworks). These are core values that have advanced the field significantly, and I believe they will continue doing so for a long time. –  Sebastian Oct 5 '13 at 12:58

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