The Model View View-Model pattern gained a lot of momentum lately. It allows to reduce the code in the code behind class of a form or user control to a minimum. Therefore, unit testability is improved dramatically compared to other view patterns like MVC/MVP.
However, when I design software, I follow (amongst others) the principles of SOLID (link).
The first principle in SOLID is the Single Responsibility Prinicple (SRP) that states that “A class should have one, and only one, reason to change.” (link)
And here start my concerns about MVVM.
Just a quick announcement that I’m going to have a speech at the Prio 2009 in Munich on October 28. or 29. 2009.
The main topic of the Prio conference this year is “User Interface”.
I’m going to talk about UI development the TDD way and show how to use the Passive-View-Command pattern for better testability, extendibility and changeability.
I’m touching a lot of topics in this session:
- MVVM – Model View ViewModel pattern
- WPF commands and “normal” command pattern
- Unity – Inversion of Control Container
Everything will be shown with the help of a sample application which is distilled from the open source project collaboration tool ProCollEE.
Information about all the sessions can be found here.
When I’m coaching teams in Test Driven Development (TDD), I’m often asked how to deal with the User Interface (UI). The problem is that the unit test frameworks are weak in testing Forms, Controls, Buttons, Grids, and so on. Weak because they do not support it at all or the tests become very fragile (e.g. renaming a Label causes the test to fail).
We address this problem with the Passive View Command pattern, PVC for short. Continue reading