Sunday, May 4, 2014

Lesson #1 From TDD: Do Not Fear Errors

Test-Driven-Development is really a bit of a misnomer. It's really more like Error-Driven-Development. In a (nearly over-)simplified form, you write and then run your tests, read the error messages and then write the code that will prevent those errors and failing tests.

The first lesson for me (and perhaps for you, too) is to resist the gut reaction of "oh, no, I suck at this" when errors and test failures come up instead of automatically passing tests. Theoretically, I understand that we're going to get more failures than successes in TDD. It's convincing my subconscious that all of those 'F's really are expected and OK.

I've been working through the Ruby for Newbies: Testing with RSpec tutorial over at Nettuts+. That brings me to my first lesson for TDD tutorials: read the entire tutorial first! I spent nearly an hour trying to figure out why I was getting a strange error when running the first test, only to scroll down a bit and see that we're supposed to get that error at that point of the tutorial. That's when I remembered a nearly identical problem (same problem, different error) while working through Michael Hartl's Rails Tutorial. Sigh...

Tee Design by CoryWayDesign

Enough introspection. Back to the fray!

No comments:

Post a Comment

Comments? Questions? Complaints? Coladas?