The first big piece of software that I ever worked on I started in my early twenties. I was young, saw an opportunity and dropped out of university to do what we now call a start-up. At the time, I thought I would revolutionise the cabinet-making industry.
At first, everything was going well. I was careful in how we built the software, and we had some initial success. As we saw more interest in the software, we grew our team and added more developers.
But as the code base got bigger, it also got more complicated. Customers liked our work, but they always wanted just one more feature. Wanting the business, we dutifully added the features, making the software more and more complex. We had to test everything by hand, which took time. I was always scared that we would release something that got our costing algorithm wrong and cost a customer a lot of money.
After five years, our software had hundreds of thousands of lines of code and many users. One fateful day, my business partner walked into the office and approached me with the exciting news of a potential new customer. We only needed one more feature!
At that moment, I was consumed by a sense of utter helplessness. I had lost all confidence in our code base and remember thinking, “you couldn’t pay me enough money to add that feature - even if you offered me a million bucks, I don’t think I would do it”. Ultimately we had hit that threshold where the product was simply too complicated, which was the end of its growth. The product continued to be used for many years but we never added any substantial features to it from then.
A few years later, I worked on a different project. This time, I had learned how to use test-driven approach. The code base was extensive and complex, but we test-driven development to add small clearly defined unit tests. I remember one day being asked to add some functionality to the system. It took me a few hours to code, I then ran it through our build server - all the tests passed, so I pushed it to production. I went home and had a great night’s sleep.
And that is how valuable a test-driven approach is to me - it’s worth a million bucks and a good night’s sleep.