Saturday, May 12, 2007

Solving Sudoku Using TDD

Thanks to some encouragement from Ravi suggesting I try my hand at a Sudoku solver, I've written up my experiences writing one using TDD. My main goal was to see if using TDD would be helpful. I thought it was. However, you can judge for yourself. I think the experience confirmed my opinion that using TDD is not a magic wand that allows algorithms to just "emerge," but on the other hand it is a useful tool to move forward in small steps and to design code to be as intention-revealing as possible.


Alberto Savoia said...

Hi Vladimir,

I enjoyed reading about your Sudoku (and other projects) w/ TDD. I also liked very much how you describe that TDD is not an algorithm generator – great way of putting it.

Anyway, I thought I’d use JUnitFactory to generate a dashboard for it to see how well you did on code coverage and some other metrics you got by using TDD.

My expectations were that you’d score extremely well in terms of coverage and have an excellent method complexity profile. I was not disappointed.

You can see the dashboard I generated at:

Would you mind if I use your code in an upcoming blog about using JUnit Factory dashboard for running JUnit tests and generating coverage and metrics reports?

It’s OK if you prefer not to, just let me know.

And thanks for some interesting and illuminating reading.


PS Since you wrote a little piece about Zen and SW development, I thought you might enjoy this as well.

Anonymous said...

It seems the link to your writeup is broken! Can you fix it?