3 ms·
Until recently I was looking at TDD as a necessary evil - yes, it saves your ass a lot of times, but writing tests doesn't feel fun nor very productive - I don'
by Tomek_ 16y ago
Until recently I was looking at TDD as a necessary evil - yes, it saves your ass a lot of times, but writing tests doesn't feel fun nor very productive - I don't know if I can speak for others, but for myself there are two things that I like most in programming, 1st: creating cool, new features; 2nd: polishing/refactoring the code until it becomes a state of art.
And what I've found out not a long time ago is that TDD helps a lot with the 2nd point, but only (again, at least for me) if you aim for the 100% code coverage. Yes, I know it sounds silly, and pointless, and that code coverage doesn't mean that much, but anything lower than those 100% makes you too relaxed about quality of the code and leads to skipping the parts that are harder to test, and most often they are hard to test because they are badly written (bad architecture, bad API decisions, etc.).
When you go for a 100% CC you have to examine all those parts, and change the code so it actually can become testable, and it's often hard and requires making big changes in many places. It's challenging, but challenging means fun. And you learn a lot, but learning a lot is fun too. So, double win (triple, if you count easier bugspotting)!