Swizec Teller - a geek with a hatswizec.com

Senior Mindset Book

Get promoted, earn a bigger salary, work for top companies

Senior Engineer Mindset cover
Learn more

    You can side-step a yak, they don't all need to be shaved

    Last week we said that yak shaving gets in the way of making steady progress. A reader wrote in to pick a bone with my definition.

    I said that yak shaving trends towards procrastination. You're moving things around and making unnecessary improvements because you're not sure how to move forward on your main goal.

    The reader, who did not leave a name, had this to say:

    👎 Actually I like it, as usual. But wanted to get your attn, and pick one nit: "Yak shaving" is usually something you HAVE to do in order to do the thing (needed to do the thing... * N) closer to your goal.

    Did Donald Knuth, patron saint of yak shaves, really need to invent TeX to make progress in his legendary The Art of Computer Programming book? Which remains unfinished after 56 years in progress.

    I think when yaks aren't procrastination, they might be tunnel vision. You're so focused on the right solution, you miss the good enough solution.

    Yaks as tunnel-vision

    A lot of yak shaving happens because you get an idea for the right way to solve a problem and become so focused on that solution that you miss easier less good solutions.

    Just last week I noticed what looked like a leaky transactions issue. You'd try to submit an order and sometimes get an error about unique constraint violations.

    I dug into the code and omaigod whatisthis it's peppered with db.session.commit statements. These seem to write objects to the database before they're done setting up. We write, then read, then update, then write again. That first write may have temporary values which trigger database errors.

    This felt wrong to me. That's not how you use database transactions!

    I spent 3 days studying documentation and reading code from the bowels of Flask and SqlAlchemy to figure out how transactions are meant to work. Every change I tried to fix the issue broke our code. I still don't understand how this thing decides when to start and end a transaction 🙃

    Pulling my hair out over lunch one day I explained to a coworker "Look people are triple clicking this button because it's a slow operation and then our code tries to write things in parallel and ... waitaminute!! 💡"

    This wasn't a transaction problem! It's a UX problem!

    After lunch I added a loading state to the form. This gave users feedback that something is happening and disabled the button while our backend processes the request. The issue went away and I didn't have to re-write half our server code to avoid the read-update-write pattern.

    Yes the problem isn't fixed. But the UX is better, I learned a bunch about our frameworks, and there are plenty of other fires to fight. Better!

    This whole time I was shaving a yak that could be side-stepped! You don't always have to go through a problem, you can go around.

    But you won't realize this until you stop and look around. Also known as hammock driven development.

    Cheers,
    ~Swizec

    Published on September 18th, 2024 in Scaling Fast Book, Productivity

    Did you enjoy this article?

    Continue reading about You can side-step a yak, they don't all need to be shaved

    Semantically similar articles hand-picked by GPT-4

    Senior Mindset Book

    Get promoted, earn a bigger salary, work for top companies

    Learn more

    Have a burning question that you think I can answer? Hit me up on twitter and I'll do my best.

    Who am I and who do I help? I'm Swizec Teller and I turn coders into engineers with "Raw and honest from the heart!" writing. No bullshit. Real insights into the career and skills of a modern software engineer.

    Want to become a true senior engineer? Take ownership, have autonomy, and be a force multiplier on your team. The Senior Engineer Mindset ebook can help 👉 swizec.com/senior-mindset. These are the shifts in mindset that unlocked my career.

    Curious about Serverless and the modern backend? Check out Serverless Handbook, for frontend engineers 👉 ServerlessHandbook.dev

    Want to Stop copy pasting D3 examples and create data visualizations of your own? Learn how to build scalable dataviz React components your whole team can understand with React for Data Visualization

    Want to get my best emails on JavaScript, React, Serverless, Fullstack Web, or Indie Hacking? Check out swizec.com/collections

    Did someone amazing share this letter with you? Wonderful! You can sign up for my weekly letters for software engineers on their path to greatness, here: swizec.com/blog

    Want to brush up on your modern JavaScript syntax? Check out my interactive cheatsheet: es6cheatsheet.com

    By the way, just in case no one has told you it yet today: I love and appreciate you for who you are ❤️

    Created by Swizec with ❤️