Bodhisattva in Training

November 20, 2006 Unit Testing

A Crucial Difference

I was reviewing a yet to be published article by Stefan Jungmayr, author of Improving testability of object-oriented systems. I got his permission to share a quote from it that struck me as the most profound difference between good OOD and Testability.

Indirect dependencies are much more relevant to testing than to implementation tasks because their potentially negative effects on test tasks are not reduced by design techniques like encapsulation and information hiding.

Many times testability is the only force in the system that puts focus on indirect dependencies. When I was prototyping DX Testability I diverged from the standard way for computing Efferent Coupling. I counted indirect dependencies as well as direct. I knew that indirect dependencies are important to testability yet I had not put together how in most cases they are not a concern in good OOD.

A simple example of this that most can relate to would be if our test subject or one if its dependencies had an indirect dependency on the application’s database. If you are working to place your test subject under a unit test you will be forced to deal with this indirect dependency.

Point being that testability deserves direct attention. It is not something that is just of interest academically. If you value unit testing then testability is of interest to you.

Leave a comment