Hints that your strategy isn't working
“Yeah, it’s a good start... but I don’t think it’s the right approach.”
The year is 2011, it’s my first programming job, and the look in my boss’s face expressed clearly that he was not pleased with my work. He leaned across my desk in the living room of the Palo Alto home where we lived and worked, and gestured loosely towards a region of code on my screen.
“See how you have all those comments explaining this complicated function? That’s a code smell. Ideally you can re-write this so that the code is more self-explanatory and easier to work with.”
By that point I wasn’t even listening. All I could think about was that he said my code was smelly! What a weird turn of phrase!
“Code smells?”, I asked, bewildered.
“Oh, right! It’s a thing!”, he said, explaining that “code smell” is a term that programmers use to talk about signs of design flaws in source code. The idea is that it’s not exactly a bug, but it indicates a problem. It’s like when you step in dog poop — the actual problem is located under your shoe, but it’s your nose that detects the first sign that something has gone wrong. (I should know, I just got a puppy.)
And with that, my boss gave the table a solid pat, and wished me well. I chuckled and got back to work. And then the idea of code smells sat dormant in my brain for nine years.
Until today, when I realized that strategies can have smells too.