Wednesday, October 10, 2007

Testability and Design

As Michael Feathers notes, 'The Deep Synergy Between Testability and Good Design', there is a lot of discussion about how to test private methods. I think he's absolutely correct that the need to test a private method is a hint about the design. I've been reviewing a class that I was never completely happy with because it exposes private methods for testing. Looking at it today I'm sure it would be possible to extract a class that would improve the design and fix the problem. It would have been much easier to clean this up when I was writing the code than to find the time to fix it now. I wish I had listened closer to the hint that my test was giving me.

It's pretty amazing how much we learn about the goodness of a design when try to test it. In the past I used to write fewer and larger classes than I do today. Most of the reason for the change is for better unit tests.

3 comments:

Joshua Smith said...

Thanks for your help in describing this. Great review! Also turn your attention that it needs to search for mobile software development companies if you need mobile software developer.

Joshua Smith said...

Thanks for great posts. Let me mention about home insurance rates for USA policy owners home insurance providers. Compare online quotes on homeowners insurance.

Joshua Smith said...

Thank you for writing this great info. You have nice chance to choose casino affiliate programs. The most common casino affiliate programs such as gowild and great poker rooms such as redbet poker affiliates.