Last week I mentioned that "code is expensive" and a reader βΒ Dakshin β wrote back saying "Wait, if code is expensive, why are you throwing it away??"
Their question was about the second example in What does "solve problems" even mean, throwing away a wrapper library and using the vendor SDK as a way to unblock 5 teams. My thesis is that without this library, teams will be able to move independently and control their destiny.
And Dakshin is right! We have this working code that solves problems and people have put good effort into building. So why do I wanna throw it away?
I love deleting code. Nothing brings more joy than grabbing a bunch of code you don't need anymore and throwing it away.
Like when you spend 3 hours working on a tough problem, write a bunch of code to figure it out, then realize you can do it all in 2 lines of code with a different approach. Cmd+A, delete.
Context matters
But in this case it's even simpler β the library has outlived its purpose. Now it creates more problems than it solves.
Its main value-add was cleaning personal information from feature flag requests. We don't need that anymore thanks to signing the right pieces of paper with the new vendor.
My team owns 43% of all feature flags and we never adopted the library. Before the library, we used to call the backend. Then the backend updated to use this library ... and we kept our old approach because it worked.
That means half the library's code was never exercised. Who knows if it even works π€·ββοΈ
And the iOS team was always on their own. You wouldn't want a shared library between TypeScript and iOS anyway.
A third of our ecosystem uses this library. Suddenly feels like a much easier decision doesn't it?
And consider this: What happens when the library everyone's using upgrades to the new vendor, but the individual teams aren't ready to migrate their feature flags? Mayhem.
Instead of mayhem, we can let old flags keep using the old library and vendor while new flags gradually start using the new vendor directly. Separate dependencies βοΈ
So, when do you delete code?
All code is a liability. Cheap to produce, expensive to maintain. It's not a work of art, it's a tool to achieve a goal.
Delete when it stops providing value. It's just code, you'll write more tomorrow.
Cheers,
~Swizec
Continue reading about When to throw away your code
Semantically similar articles hand-picked by GPT-4
- Don't neglect your upgrades
- What does "solve problems" even mean
- Tech debt is a tool
- Better is good
- 4 years of coding in San Francisco, lessons learned
Become a *true* Senior Engineer
Get promoted, earn a bigger salary, work for top companies
Getting that senior title is easy. Just stick around. Being a true senior takes a new way of thinking. Do you have it?
The Senior Minset email crash course
Get a free chapter from the Senior Engineer Mindset book and a sample audiobook chapter, followed by a Senior Mindset 101 email course.
You'll get insights to apply at your work right away.
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 β€οΈ