TestDrivenDevelopment

ThoughtStorms Wiki

Does writing tests "flatten" the hierarchy (or complex structure) of your program?

For example, evey little piece, in order to be tested, needs to be quickly accessible (to set up the test).

Making your code testable makes it shallow. You can't have structures and functions that can only be constructed or accessed deep within many layers of function calls, or dependent on a context of millions of other instructions.

Rather than shallow I'd tend to say decoupled. The complex structure of the program stays about the same. Maybe gets more complex in fact since I find that TDD often makes you break things up into more smaller classes. What you do get however is ways of creating and testing components individually.

AdrianHoward