The other day, I received a T-shirt from a local tech recruitment company. On the front, there is an illustration of a yak with some text that reads: “Don’t shave the yak”. You can download the design here as a wallpaper. I’d never heard of the term before, so it confused me quite a bit! Luckily, the company included a little card that explained what it meant, and, as it turns out, it’s really relevant to me!
What does it mean to “shave the yak”?
Assuming you’re as ignorant as I was, here’s a bit of history. The term “yak shaving” was coined in the 90s by MIT Ph.D, Carlin Vieri, after watching an episode of “The Ren & Stimpy Show”. The show has an episode called “Yak Shaving Day” that caught Carlin’s attention due to how odd it was.
But what does the term mean? Yak shaving refers to when you set out to accomplish a goal, but that goal has a dependency on another task. That task, in turn, has dependencies on even more tasks and before you know it, you’re shaving a yak and can’t remember what you originally set out to do.
A real-world example of shaving the yak in programming
Shaving the yak is something that can happen while doing anything, but it’s particularly common in programming. Let’s say, for example, you’re tasked with fixing a bug. You find the offending code and just as you’re about to fix it, you realise you could turn it into its own function.
You go about encapsulating the code in a function, but it becomes a bit more lengthy than you initially anticipated. At this point, you think it’s probably best to put this function into its own file to reduce clutter. You start thinking about the best place to put your file. You could update the project structure and create a utils folder for similar files and… What were you doing again?
How to avoid yak shaving
By now you might be thinking: “What can I do about my yak shaving habits?” Fear not, fellow bovine barber. There are ways to tackle your bad workflow habits.
Firstly, talking specifically to the example above, resist the temptation to refactor while you’re busy with a bugfix. That’s not to say you should never refactor your code, just keep it as a separate task and tackle it some other time. I can already see the Twitter comments disagreeing with me on this one. Hey, if you can do it and stay focused, good for you. This post is for those of us who end up in the pastures.
Secondly, when approaching a problem, spend some time planning beforehand. Often, you can come up with a simple solution before you get started. If you start without much of a plan, you might find yourself coming up with a better solution halfway through and that’s a one-way ticket to yak shaving town.
Thirdly, think of the famous quote: “When you find yourself in a hole. Stop digging.” If you find yourself distracted by lengthy tasks that aren’t bringing you closer to your goal fast enough, take a step back and reevaluate. There might be a simpler solution.
TL;DR / Conclusion
A lot of us find ourselves shaving the yak from time to time. Spend some time to think of a simple solution before you get started towards a goal. After you’ve started, be cognizant of work relating to your task that might be considered distractions. Code that needs refactoring, for instance. Stay focused on your plan, you can tackle that after the problem at hand.