Thanks, Wolf, for putting on another great C4 and giving me the chance to speak about unit testing. At the end of my talk, I put up a list of books for further reading, and wanted to throw up quick and dirty links to those:
Refactoring is a classic book on the art of cleaning up code as a you go. Ten years later, this is still a fantastic book. It covers code “smells” that indicate code that needs refactoring and describes over seventy different refactorings you can apply.
These two books are good if you want to learn more about test-driven development. I’ve only read the Kent Beck book and really enjoyed it, but I’ve heard good things about Astels’ book, too.
Unit testing and doing test-driven development is much easier on greenfield projects. If, however, you have an existing code base that you’d like to add tests to, then Working Effectively with Legacy Code is for you. I love that Michael Feathers controversially defines “legacy code” as “any code without tests”.
This is a behemoth of a book, but it’s chock full of good information. It covers a lot of patterns and anti-patterns of test code, and will almost certainly save you time by if you’re new to unit testing.
This book is basically Pimp My Code on steroids. There’s a few examples of how to clean up code using refactoring and unit testing, and it covers good OO design principles along the way.