“I don’t care much for unit tests,” my boss told me. “If you have to have tests, it means you haven’t really thought through your code well enough. Tests just slow you down. Why would you write tests if you already know what you need to do?”
“Oh,” I said. I didn’t have an answer for that question. But I got a pretty clear idea that I shouldn’t waste time writing or worrying about tests.
He was — no is — a brilliant programmer. He had built several WordPress plugins that are to this day widely used. Certainly, I’ve never built anything so extensive or successful. So who am I to say he wasn’t right about it?
All I know is that trying to figure out what that code was doing took me hours, sometimes days, and even then I wasn’t always sure. I always figured it was because I wasn’t that smart.
In retrospect, I wonder if developers on other projects within the company were going through some of the same things. They all seemed way smarter than me. Probably because they were! But they, too, now that I think back on it, would be working on bugs for several weeks at a time. Only one other person on the team knew anything about unit tests.
By the end of my time there I wondered if I would ever amount to anything as a programmer. I’d been there more than a year and still couldn’t follow most of what was going on.
I still can’t lay any claim to brilliance. But several years later, with the benefit of hindsight, I’m fairly certain that at least part of the problem was that the code base was simply beyond thinking through clearly. Only one person really had an idea how it all fit together.
Today, if I had it to do over again, I would have an answer for him. And I would insist on writing tests. Not because his ideas weren’t brilliant, but for all the rest of us who were pretty good but lost in a swamp of unintelligible code.