Jean Hsu
4 min readDec 4, 2014

--

This was originally written on December 2, 2014 and published on Hatch, our internal version of Medium. Read more posts published on Hatch at Inside Medium.

I just finished reading The Life-Changing Magic of Tidying Up and it stirred up all my code deletion happy feelings. If you haven’t read that book, I’m just channeling my inner Marie Kondo.

Despite frequent refactorings, and carefully considered design changes, you may one day look at your codebase and realize that it has a lot of clutter. Do you really need that function? Those new routes you hooked up a few months back haven’t been used at all — do they even still work? Before refactoring portions of your codebase, always consider deleting code first. Delete first, then refactor what’s left.

When you delete code, don’t say “Why was this even here?” or “This code was terrible, I’m glad it’s gone now.” Thank your code for the job it’s done. Take a careful look at it, and express gratitude for the role it has played. Maybe it was never used and was part of a system that was never launched. You can thank it for helping you think through a problem, and for helping you realize that you didn’t need it after all. Or maybe it was an in-between solution that let you launch something more quickly. Thank the code for its important role in letting you ship your feature, and let it go. Code deletion should be a celebration.

--

--

Jean Hsu
Jean Hsu

Written by Jean Hsu

VP of Engineering at Range. Previously co-founder of Co Leadership, and engineering at @Medium, Pulse, and Google.

Responses (3)