views:

53

answers:

1

Hello,

consider a mvvm/wpf application, what advantage has it to do for example 3 projects (View, ViewModel, Model) in a visual studio solution?

A: 

I can't think of any real advantage to splitting your view, viewmodel and model into separate projects, unless they are large and you need better organization or you would like to compile them to dlls that can be versioned independently.

Eric Mickelsen
well I have just read doing MVVM pattern separating the View from the ViewModel as different projects should be best...?
msfanboy
People writing on MVVM will often suggest it, but also note that it's not really necessary, e.g. http://msdn.microsoft.com/en-us/magazine/dd458800.aspx. It may have the couple of advantages I noted, but putting them in one project won't really hinder your implementation of MVVM. Just use the same criteria for splitting code into projects that you normally would.
Eric Mickelsen
well what are the criterias for splitting my code into several projects independent from mvvm?
msfanboy
Mainly the two I stated in my answer. It's pretty much the same thinking as when you decide how to organize your classes and code blocks in source files. You have to make logical divisions and try to maintain a nice balance between the number of parts and the sizes of those parts. You want to avoid huge projects for the sake of compilation time, loading time, reusability and sheer overwhelming complexity. At the same time, too many projects also means over-complication and each project will have a gazillion references that make your dependencies impossible to keep track of.
Eric Mickelsen