TDD and the gift of failure | Makers Academy Remote, Week One
I doubt many people would want to say that they’re good at failing. It doesn’t exactly sound great! Failure is something to be afraid of, ashamed of, something to avoid at all costs and cover up when it happens. We often get trapped in considering failures in our work or our lives to be reflections on ourselves as people, demanding that we be perfect and constantly successful and remonstrating with ourselves when we can’t achieve it.
What brought me to Makers Academy was a series of failures, to the point where I found myself exploring new depths below rock bottom. I had a bunch of ideas and plans for what I wanted out of my life, and over the course of the last couple of years they all collapsed under one pressure or another, knocking one another over as they fell. At the end of September, right as I’m (hopefully!) completing the course, I’m going to turn thirty, and my life doesn’t look even remotely like I had expected it would by now.
But what I’m starting to really learn and internalise for the first time is that failure isn’t a moral indictment, or a reflection of being a ‘failed person’. Failure is a chance to have another go, and to do things better.
The first week at Makers focuses on getting us into the mindset of Test-Driven Development, in which you write your code only after you’ve established the tests that you want that code to be able to pass. You have to start by failing the tests- and how you fail the tests is what teaches you what sort of code you need to write.
Sometimes it’s seemed so obvious that I questioned the purpose of the exercise. What’s the point of writing and running a test that looks for a class or a method that I haven’t even created yet? I know how to make the test pass first time! But I’ve found that the process of test — fail — code — test again forces me to slow right down and really deeply examine what it is that I’m doing when I write a particular bit of code, to get to grips with the concepts at hand rather than just plugging in the right keywords and moving on.
Failure creates a space for you to stop, to reflect, to reconsider your approach, and to try again, even if the next try is another failure. Had I not failed so dramatically to stop my life from coming apart at the seams, I would never have reached the space where I decided to learn how to code. I would never have examined the things I had been prioritising in my life, and realised that they weren’t good for me and weren’t what I really wanted.
I think becoming a good programmer is going to start with becoming good at failing- at failing over and over, trying to make each failure a little bit better than the next one, and if that fails, taking the space that it creates to figure out why. Contrary to everything I’ve believed up until now, to what our society encourages us to feel, failure isn’t a bad thing. If you learn how to use it, it can become a gift.