Book Club: Working Effectively With Legacy Code - Chapter 10 (Michael Feathers)
In our latest technical book club we discussed chapter 10 - ‘I Can’t Run This Method in a Test Harness’ - of Michael Feather’s ‘Working Effectively With Legacy Code’.
In this chapter Feathers outlines some of the problems we might have getting methods under test and then suggests some ways to get around those problems.
These are some of my thoughts and our discussion of the chapter:
Tom spoke of ‘value fetishism’ whereby we get so caught up trying to add ‘business value’ that we forget to keep the code in good stead for future work.
I quite like the analogy that Alistair Cockburn uses of software development as a series of cooperative gamem and I think it’s sometimes easy to forget in the rush to get some code out for a release that we have to make sure that we don’t make our lives impossible for the next game/release by rushing code in without paying due attention.
Feathers also talks about the danger of using reflection to allow us to test this kind of code - it might allow us to get tests around the code but we’re not making the code any better and we may not notice quite how bad the code has got. We are just delaying the inevitable.
There’s a tool in .NET land called TypeMock which allows you to test pretty much anything but I wonder whether we would run into the same problems that Feathers describes above.