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

    Famous last words: Pfft, that's easy

    Coding isn't always fun my friend, sometimes it's work.

    Actually, I take that back. Coding is fun, engineering is work. Let me explain.

    2 months ago I got a new project at work. Enable customer support to change people's plans. We sell subscriptions and sometimes folks wanna change the plan they're on.

    Pfft, that's easy.

    Stop old subscription, start new subscription, fiddle start dates so it looks like nothing happened. How hard can it be?

    So I estimate the project line by line.

    Gonna have to do this, do that, oh and we need a new UI for everything, wait what they wanna change payment methods too?? Oh shit you want to do what with refunds and credits and referral bonuses!?

    I slog through the combinatorial explosion. Installment plans, plans paid once, referral credits, family discounts ... the mind recoils in horror.

    16 combinations in all. Maybe more.

    Estimate came out to 2 weeks. So much for easy. And here we are now 2 months later almost done.

    More tests than code, 200 comments on pull requests across 4 repositories, 8 bugs from QA, 16 bugs from business, 3 years old production bugs, and I can't even count the issues I found while testing bugs. Last find was that your initial payment on a new plan never got charged. Fix took all day.

    What the hell happened??

    when you're going through hell, keep going

    Legacy code and engineering happened my friend.

    Coding is fun because you're building something from scratch. It's fast, it's free, it's beautiful. Like running in an empty green field.

    You jump and frolic. You skip and hop. You sing with the sound of joy in your heart as you create something new that's never existed before and you care not if it still works tomorrow.

    sound_of_music giphy

    Engineering ... engineering is more like threading a new subway line through downtown New York.

    Tall buildings that shouldn't collapse. Traffic that can't be too disrupted. Businesses that definitely have to keep running. Old subway lines you can't destroy. Sewage pipes you shouldn't touch. Internet cables you can't break. Power lines you shouldn't cut.

    If you're lucky you might find dark fibre and get the secret service on your ass.

    No wonder it took San Francisco almost 10 years to add 10 blocks of subway ...

    Oh and while you're keeping all that old stuff alive, you're making sure the new stuff not only supports the old stuff, but keeps working for decades to come.

    Tips for legacy code

    Click through for source
    Click through for source

    Engineers love to hate on legacy code.

    Look at how shitty it is. Look at how messy. Look how it uses old standards. Look how wrong it looks. What idiot wrote this.

    But hear this my friend, that legacy code is paying your salary. Legacy code works

    That's all you gotta keep in mind. Legacy code is legacy because it works. Your code either dies a prototype or it becomes legacy.

    Do you want your code to die? No you do not.

    So suck it up princess and fix that shit.

    The code is there because it works. Every nook and cranny is there for a reason. Even if the reason is that you didn't know any better when you wrote it 3 years ago.

    Click through for source
    Click through for source

    So change your mindset and rejoice!

    You've got a working piece of code that just needs some love.

    Whatever happened to make it look this bad – business changing their mind, engineers coming and going, or coding standards changing all around it – that code works and it pays your bills.

    Do your best.

    1. add some tests
    2. update the code style
    3. ask business if you really absolutely still need to support that feature they asked for 3 years ago and forgot about
    4. remove the dead code
    5. consolidate messy chunks into pretty functions
    6. extract stuff into classes
    7. write some notes
    8. add comments
    9. add some tests
    10. then add some more tests
    11. make sure you add tests
    12. ask a friend for help
    13. write some docs, docs are great
    14. talk to stakeholders and understand the business
    15. write it all down
    16. refactor with a new approach that consolidates what the business wants now into a clean flow
    17. oh and write some tests

    Most of all, don't stop. You're already in hell, might as well keep going until you reach the edge.

    Click through for source
    Click through for source


    Published on January 10th, 2020 in Opinions, Technical

    Did you enjoy this article?

    Continue reading about Famous last words: Pfft, that's easy

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