tags:

views:

64

answers:

1

I'm building a WPF application and working with the MVVM pattern.

I have 4 projects in my solution, 3 class libraries, Data, Model and ViewModel and the WPF executable View.

Is there anything wrong with the Model referencing WindowsBase so that I can use ObservableCollection<T> for example or can I just make use of what I intuitively feel I need without worrying about the original purposes of the class in the framework e.g. collection databinding.

+1  A: 

No problem, unless you are a conservative ;)

So no, there isn't a real issue using these, especially if they are framework dll's like the one you are referencing. There are a thousand things you should worry about before you worry about this one, like WPF performance in general, databinding is through reflection, event overhead, etc. If it makes your app more maintainable and gives you the features you need, use whatever part of System you need. Once you create the instance, everything will be fine anyway.

Now... if you are loading up tons of external dll's, then maybe that could be an issue just from paging, but usually there isn't even a way to avoid that easily. Our individual projects have about 35-40 references each... you only get a load operation on the first time through.

"They" say you should do one big assembly if you can. Usually you can't though, so that advice doesn't even really apply.

To help reduce your application's working set, you should prefer single larger assemblies rather than multiple smaller assemblies. If you have several assemblies that are always loaded together, you should combine them and create a single assembly.

The overhead associated with having multiple smaller assemblies can be attributed to the following:
* The cost of loading metadata for smaller assemblies. * Touching various memory pages in pre-compiled images in the CLR in order to load the assembly (if it is precompiled with Ngen.exe). * JIT compile time. * Security checks.

If you are using only you own code, then just for sanity's sake and the fact that VS.Net has so many issues, using fewer, larger projects would probably be better.

Andrew Backer
That's interesting, I guess I assumed that because you 'can' add several assemblies to a solution than to do so must be a good thing. I must assume less and learn more :), thanks. In my case it is just my code and the framework no 3rd party assemblies so maybe I could reunite everything.
panamack