Friday, October 1, 2010

MVVM Overview (part 2 : Model,ViewModel,View, ... what)

The Model is simply your business or data layer. It's completely UI independent.So when you develop for example a WPF application,
and you would like to switch it to a silverlight application later on, you can just re-use your Model.

Your ViewModel exposes the data to your View. So it's 'custom' build to show the data for your View,
even though your ViewModel acts independently from your View, and your View is developed independently from the ViewModel.
So they are in a way 'connected'.

Your view just connects to the data with databindings. They can be one way bindings (property to source or the opposite) or two
way binding. I'll give examples of that later on, basically it means that if you change something on the screen, if it gets
changed in your properties too, or only your property/screen changes.

MVVM overview (part 1 : What is MVVM)

So what is MVVM and what benefits are there in using it?

MVVM is a design pattern that is a variation on the MVC (Model/View/Controller) pattern.
MVC pattern seperates data model (Model) from the UI (View) and the application logic (Controller).
In MVVM there are also 3 layers: The Model (data model), the View (UI) and the ViewModel (Exposes the data from the Model
to the View), more on these layers later.

In modern applications this gives a significant advantage: The UI can be completely made by a designer, without him getting in touch with
the coding part of the application. (useful for Blend!)

Another advantage is testability, because the layers are seperated the ViewModel can easily be unit tested.

The databinding in WPF really makes this pattern shine, I'll show some examples later on.

So what are the disadvantages?

There are none! No seriously now, I don't really think there are major disadvantages in using MVVM pattern in WPF.
Maybe the fact that for some stuff (like for example showing a dialog box) .NET lacks in support, but there are MVVM frameworks that
can you help with these problems, and a good community searching and discussing solutions to these problems.

Thursday, September 30, 2010

 Well I wrote part 2 today... but I forgot it at work, so I'll post that tomorrow!
Meanwhile, enjoy some nice psytrance! ;)

Wednesday, September 29, 2010


Some information about myself..
After following evening school as developer, I got a job as COBOL developer (I know... the horror!!). It was an outsourcing company, and with the financial crisis they just couldn't get jobs enough for all employees and well the last persons hired, got to go first..

But this wasn't really a bad thing, I only did a year of developing in COBOL, but it was just boring, no shiny stuff to find in there.

So after a month of being unemployed, I got the opportunity to start in my current company as C# developer. I took some courses to be up-to-date with current technologies : WPF, WCF, LINQ, ...
I've been developing in C# for 2 years now, and my current challenge is 'mastering' MVVM (model-view-viewmodel).

So this blog is going to be for the biggest part about all those technologies; tips, code examples, an overview of mvvm, ...

In my next post I'll give you a brief overview about MVVM if you havent heard about it before.