Testing Your Patience: The Pros and Cons of Test Driven Development

Scene: It’s midnight. We slowly pan over a sparsely filled library. We zoom in on a tense, frazzled Computer Science student. With a practiced hand, he fills his code with print statements and debugs his code for umpteenth time. He steps over and over lines of code, struggling to find the reason why his code silently fails.

He could write some tests, but what’s the point? They’re bound to be as flawed as his understanding of his code, right? Besides, it would take time he doesn’t have to write all those tests. Left to his devices, he struggles for another hour or so before realizing he had an off-by-one error on one of his giant “for” loops.

I’m sure I’m not the only one who’s been in this situation. Rather than deal with the extra work of writing tests, you just decide to wing it. It could save you time, but on the other hand, it could cost you some painful nights of debugging some unfortunately timed bugs. So what exactly are the pros and cons to testing your code? Continue reading “Testing Your Patience: The Pros and Cons of Test Driven Development”