tags:

views:

136

answers:

3

I've currently noticed that many people start using this model very often. Anyways, I think it's very correct to separate logic from presentation. What more, some functionalities cannot be accomplished without it, or just very hardly. Consider a Tree that is selectable, has search capabilities etc.. But in some cases, you don't need to implement this MVVM model, although people do it.

Do you think it's correct? Wasn't the purpose of WPF to simplify coding - try to do the majority of work in XAML?

I have a feeling, that this model is often misused just for the elegance of the design, but breaks the WPF efforts.

Or am I completely wrong?

A: 

imho WPF is designed to use MVVM, so if you writing your code without this pattern will lead you sooner or later into a situation where you have to do some hacks to solve problems.

For me there are very few reason not to use MVVM, like private projects, tryout's, ...

In larger projects, everything should be written in MVVM because of the capabilities of this design pattern (enabling unit tests, prevent miss-use of UI, ...)

Martin Moser
Although it requires many times much more code?
PaN1C_Showt1Me
as I said, for "professional" projects imho is worth the effort, and I don't think that it is way more code
Martin Moser
A: 

The main purpose of seperating logic from UI is for the testability. Since you are putting all logic under ViewModel, you can write the test script for testing your logic without UI.

Michael Sync
What if I'm not planning to write test units?
PaN1C_Showt1Me
MVVM can be used with other types of testing. If you're not writing any test code then you either have a very small project (so why bother with any software organization like MVVM) or you do not care about code quality.
emddudley
>>What if I'm not planning to write test units?Yes. Like emddudley said, since you really don't care about code quality then don't borther using any design pattern or best pratice.
Michael Sync
A: 

The issue is that there is a lack of tools so it hard to pitch wvvm when someone has to write half a page of code to throw a messagebox when a button is clicked.

Yeah that's what I was pointing on.
PaN1C_Showt1Me