• May 2011
    M T W T F S S
  • Latest Posts

  • Latest Comments

  • Archives

Did I Ever Mention I Like TDD?

I’m working to change an older application to one that uses the MVVM (Model-View-ViewModel) pattern. I’m trying to change it one piece at a time, and what a hassle it’s become. I’ve come to the conclusion that a complete re-write is in order. And when I re-write I’ll be using TDD (Test Driven Development).

Singe Tier?

I’ve not worked on this for probably a year. This weekend I started work on the project again and was enthusiastic about trying to move it to a more testable environment. Primarily because I would prefer to deploy this application as a Silverlight application rather than as a WPF (Windows Presentation Foundation) application that it currently is.

So I thought I would begin at the beginning – the Welcome screen. That screen allows you to create a new file or Open and existing one. Sounded easy. However, here’s what I encountered in a single method:

  • Shows a dialog box to open the file
  • Opens the file
  • Loads the data (all by calling void methods)
  • Let’s other know that the information has changed
  • Changes the history of files
  • Builds a menu

All VERY tightly coupled – from the presentation tier all the way down to the persistence layer. And the third method I hit, which does the actual data loading if just under 100 lines of code – with a maintainability index of 40! And of course, not a unit test in site.


What a bummer. The application has some really cool functionality, but I can’t easily change to Silverlight (i.e., change the presentation tier), and can’t easily change the data access layer either. The current data access supports a single user and will not scale.

Power of Unit Testing

If unit testing had been utilized in the previous development, the tests would have been far to difficult to write with such tight coupling. As a result, the code would have naturally ended up with better architecture.

Back to the drawing board…

Leave a Comment