A Guide to Yak Shaving Your Code
How to Stay Focused When Things Get Hairy
If I had to pick the best phrase in the English language, I would hands-down choose “yak shaving” as the winner by far. If this phrase isn’t in your vocabulary and you’re learning to code, you need to adopt it. Immediately.
The phrase comes from the Ren & Stimpy show that aired on Nickelodeon in the early 90’s — which described the “Yak Shaving Day” holiday.
The term is now used to describe the process of trying to solve a problem — but running into a number of seemingly unrelated problems that you need to solve first. Often times, the seemingly unrelated problems end up way more complicated than the problem you initially set out to solve.
It’s not uncommon to have your boss ask, “Why are you doing that — I told you to do something else entirely?” You might spend 20 minutes walking him or her through the reasons why, but after this happens a few times, you’ll start to just respond, “it’s a yak I need to shave in order to do x, y, and z.”
Yak shaving is something that comes up frequently in coding, but also in the real world too.
An Example of a Yak I’ve Shaved
Several months ago, I was going to give a presentation. I started by using Google Docs for the slides, but the design of the slides looked pretty ugly. I wanted to up my game on the slides, but I was in a bit of a rush. The presentation was the next day, so I figured the easiest solution would be to use KeyNote.
I had already purchased the app on an old computer, so I was pretty sure I could download it on my new computer for free. I went into the App Store and pressed the install button. My computer prompted me for my iTunes password.
I wasn’t sure what my password was, so I did what most people would do in the situation. I guessed. I got the answer wrong a handful of times, which had an unexpected consequence — after I guessed it wrong 5 times, it locked me out of my account.
At the time, the only way to reset your password was to go through security questions. I had to answer two questions:
- Which of the cars you’ve owned has been your favorite?
- Who was your least favorite teacher?
I wasn’t sure what my favorite car was. So I did what anyone would do in this situation…
I guessed a bunch of times. Then I failed to answer those questions. Then it locked me out of the password reset flow.
From there, my only option was to schedule a call with Apple Support to have them reset the password on their side after they verified a few details. I picked up my phone and called Apple Support, explaining my situation to the assistant.
In order to reset my password, I had to give two pieces of information to them that would prove my identity:
- My social security number
- The credit card number that was on file
Now, I had recently lost my credit card and had a new number issued to me, but I hadn’t updated my Apple account yet. So I hung up the phone with Apple Support help, and picked up my phone to call up Bank of America.
They verified my information, I gave them my credentials, explained the story, and asked them for my old credit card number. They gave me my no-longer-working credit card number, and I called up Apple Support again, and this time was able to pass the security questions.
I hung up the phone, entered my new iTunes password, and pressed the install button. It presented me with an error message because I didn’t have enough space on my hard drive. I had been running short on free disk space for a while, and was meaning to get an external hard drive to move some files onto.
I realized I didn’t have enough time to move files onto an external hard drive since it would take several days to ship from Amazon, and I needed the presentation ready for the next day, so instead of moving files, I started looking for files to delete.
But while I’m at it, I should really research and buy an external hard drive so next time I run out of space, I can solve the problem the right way…
The story could go on like this forever
Getting KeyNote installed took me several hours. Designing the slides took me around 15 minutes.
Doing seemingly random tasks that I needed to do in order to complete a pretty easy task is what yak shaving is all about.
While a story like this seems pretty silly, writing a program which contains a lot of imperfect code that happens to work most of the time is a minefield of potential yaks that can stand in your way.
Experienced developers will generally try to steer clear of yaks by rethinking the problem, analyzing different solutions, and picking the most efficient one. For example, in my story, I easily could’ve booted up my old computer that already had KeyNote installed on it.
Problem not totally solved (I still wouldn’t be able to install new programs on my computer) — but saved for a different day.
Be aware of the army of yaks that threatens your time and sanity.