I've been retrofitting tests onto legacy code at work as I make some
changes to it. (So what's new?) The code has classes that are not
really following the singlre responsibility principle. The other day
I extracted a class to separate out a responsibility. Once I did
that, I could more easily fit tests for that single responsibility
onto the newly extracted class.
When a class does too many things, its really hard to write tests for
it, because you have to configure the universe in order to setup the
initial conditions for the test. With a single responsibility the
amount of setup is much less and the setup is directly relevant to the
test you're trying to write.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>
Legalize Adulthood! <http://blogs.xmission.com/legalize/>
Show replies by date
Gahhh... damn sleepy fingers sent this to the wrong mailing list,
sorry guys.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>
Legalize Adulthood! <http://blogs.xmission.com/legalize/>