“Leave it a little better than you found it” isn’t good enough.

We’ve all heard the developers lament — “So when exactly do I find time to refactor code?” and we’ve all heard the pithy consolation — “Everytime you touch code, just leave it a little better than you found it.”

The problem with LIBTYFT™ is that it just isn’t good enough. Sure, I can add some documentation to the user model, cut out a few unused accessor methods and still complete my task in time for our weekly Scrum Kanban Agile Open Office Holacractic Meetathon Fest Conf but what about when the dependency injection architecture we chose to go with has accrued so much cruft that it’s making devs fear adding new classes to the code? Or that hack you put in to quickly access some database records has grow claws and tentacles so big that you don’t even know what layer is supposed to be the model anymore?

Refactorings like that require time, patience and deep thought. You can’t just “Leave the code a little better than you found it”. Sometimes you have no choice but to burn the house down and bathe in the blood of your binary enemies. Your sanity and the future of your project depends on it.

If you liked this, click the 👏 below. I notice each one and I’m grateful for every one of them.

For more musings about programming, follow me so you’ll get notified when I write new posts.

Head of UX Engineering at GOJEK