So, turns out TDD does not actually stand for “Three Dozen Donuts.” Darn. It actually stands for Test-Driven Development. And it feels entirely foreign to me.
With TDD, there are very clear steps to writing code. First, I am supposed to write a failing test. *Gulp* Purposely failing? That makes me incredibly nervous. But then I get to write code to make the test pass, and everything is wonderful. Then I go back and refactor – that’s coding speak for editing – and make it nice and pretty. Phew. Then you start the process all over again: Red, Green, Refactor. Repeat as necessary.
Until we started TDD, I usually approached writing code in the same way I approached writing papers: all at once. Put all of my thoughts (aka “brain vomit”) onto the page, and then go back to figure out the structure. And then rewrite the whole thing.
However, when we TDD, I am forced to take things one step at a time. Which, it turns out, is incredibly helpful. One of the most frustrating things for me as a newbie programmer is that my code often doesn’t work. Error messages galore. The beauty of TDD is that when something is broken, I know exactly where it’s broken – even if I don’t yet know how to fix it. The struggle of course, is that it requires patience. Lots of patience.
So I’m learning to patient, one test at a time. Now, I really need to find a donut… I’ve been hungry since I started this post. Cheers!