I’m a big fan of unit testing and promote it whenever I can – not only does it help create a code base that a better quality, but it also lets you keep things consistent. No more of the “cross your fingers” kind of coding. A good, well-written set of unit tests can save you a whole world of hassle in the long run. Taking it one step further, you get to TDD (test-driven development) where you write your tests before you even write your code. You start with the usual “W”s – why, where, when, how (yes, I know that last one’s an “H”s) and develop the test for those rather than looking at a current chunk of code and testing what it already does. There’s some people that swear by it, one of them being the author of this book.
I’ll try to put up another post when I get closer to the end – it’s hard to find time to sit and read these days, but just little nibbles at a time work just fine.
Thanks a lot for the kind words, Chris! Happy to hear that you’re enjoying the book. I hope you do get around to the third part, which I think (or at least hope) will have the most practical value – it shows TDD in practice in five sample projects (which build upon the lessons from part 2).
Looking forward to your final thoughts when you’ve completed the book 🙂
Hey Christian – well, it’s a great book, very useful. I look forward to the rest…just wish I had more hours to squeeze into the day to get there faster 🙂
Yeah, I purchased this book and have just only finished the first chapter. He definitely pays homage to Kent Beck and the style of exposition reminds me a bit of TDD by Example in that he (in this first chapter) actually writes a simple testing framework and then tests strftime implementation. So far so good! I’ll check back once I get further in.