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

    Ways to ask but why

    ~~sometimes~~ all the time you find code that makes you go O.o Someone did the weirdest thing, but it works. Probably.

    My favorite thing to say in these moments is "But why?". When it's really weird and we're good friends, I post this gif.

    You have to be careful with that. It works when trust is super duper extra high and even then you have to be ready to back it up with a good conversation.

    Here's a few better ways to ask that question.

    • What problem does this solve for you?
    • What do you like about this solution?
    • Have you tried <obvious approach>?
    • I wasn't around for this, can you explain why <obvious approach> wouldn't work here?
    • Have you seen <library that solves this problem>?
    • I saw this solved a different way in <other part of codebase>. Would that work here?
    • In past projects I've done <easier approach>. What do you think of that solution? Would it work here?

    Asking "but why" makes people feel judged and puts them on the defensive. Personally I love explaining but why and will talk your ear off. But normal people have a much smaller ego and will shut down when confronted directly.

    Instead you approach with obvious curiosity, validate that this is in fact a brilliant solution you would never think of, and ask about all the constraints they were solving for that you didn't know about.

    60% chance they tried the obvious solution and it didn't work. That's why the code looks weird. It has to!

    Then you ask them to put that answer in a comment.


    PS: the last 2 will probably result in a "Oh thanks! I'll do that next time". Let it go, next time is fine

    Published on September 29th, 2023 in Uncategorized

    Did you enjoy this article?

    Continue reading about Ways to ask but why

    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 ❤️