Made with only the finest ingredients

I’m learning to write code in Ruby using a method called Test Driven Development, or TDD for short. The principle, as I understand it, is that the software plan is boiled down to the smallest possible problems. From each problem we are then instructed to follow a very prescriptive method that involves trying, and failing, to do what you want to do in real time code (we’re using irb), replicating this in an automated test using rspec, running the test and looking at the errors. We then use these errors to guide the writing of the simplest possible solution to pass this test and then we start again with the next problem.

The temptation is to skip tests — every time I see a step there’s a voice in my head that says “Nah — come on, you can miss the irb step, right?” or “really do I have to do a unit test and a feature test — surely just a feature test would do?”

Despite this my pair and I persevered (this course is the opposite of a super hero movie, I never work alone), and what I noticed was that despite the feeling of moving slowly by following these steps, we were actually making really good progress — and really importantly we were understanding why we were getting places, and making few mistakes. When our process did differ from the “answer” (“answer” is in itself a problematic concept, one for another blog), we understood how and why, and were able to make informed decisions whether to refactor to match the tutorial, or to stay with our different version and why we preferred it.

Reflecting on all of this I thought about food, food preparation and dining. If we were in the business of learning to cook, then what kind of chef’s do we aspire to be? Everyone on this course is looking to change career, and heavily invested in it. So this isn’t some home cooking/hobby vibe. We need to think fine dining — people will be paying us money for our code. In that context I thought about the care a chef puts in — you would examine every ingredient, every berry, every leaf. You don’t want a sad bruised leaf on the plate, or some squashed tofu. You taste your cooking constantly — you clean up, you care, you love the food, you attend to it — and all this comes out in the dish and the experience. I want to be that kind of developer— I want to know that at every step I am putting love, attention and care into my ingredients. I want to be tasting and testing my recipe — is it still balanced and good now I’ve added a new ingredient? Is it the best it can be at every step?

In this context I can see TDD as my friend to being the best, and weirdly the most efficient I can be.