Agile Zone is brought to you in partnership with:   Listening to
your tests: An example    • submit to reddit  I was recently
reading a blog post by Esko Luontola where he talks about the
direct and indirect effects of TDD and one particularly
interesting point he makes is that driving our code with a TDD
approach helps to amplify the problems caused by writing bad
code.   This is something Steve Freeman and Nat Pryce talk about
in their book and we recently had an example of this which
really stemmed from a failure to drive this particular piece of
code from the outside in.  We'd reached the stage where one
object was taking in 8 different parameters in the constructor
and then only used 2 of them in any one path through the code.
The code was pretty bad but it was even more noticeable how much
of a mess we'd made when we had to write a new test.  This is a
rough example of what the test fixture had begun to look like:
public class BadObjectTests         private double parameter1 =
0.10;         private double parameter