The Life-Changing Magic of Tidy Code — Applying KonMari method to code
After watching a couple of episodes of Marie Kondo’s show on Netflix I picked up her book ‘The Life-Changing Manga of Tidying Up’ as I’ve always been into organisational techniques and the work she did with the people on that show really struck a chord with me.
As someone who works at a consultancy my day-to-day job is dealing with legacy code and tidying it up for the client so it’s easier to work with and is more maintainable in the future.
The KonMari method takes things a step further by bringing sentiment into the process and I think that’s something that’s easy to overlook when refactoring code.
Now I’m not suggesting that developers say ‘thank you’ to every line they delete as refactor code but I think there’s something we can learn from taking the time to understand the value the code delivered instead of just saying ‘which fucktard wrote this!’.
The KonMari Method
Marie Kondo’s manga tells a story of a young professional who is tired of coming home to a messy flat, guys she brings back to her flat calling her messy and how through the KonMari method she is able to realise her dream home through de-cluttering and organisation.
I’ve selected a few of the steps from that process I think could be applied to a codebase to make it easier to work with and ensure it ‘sparks joy’ for the team working on it.
Decide to tidy up
In the book the protagonist realises she has a cluttered home that isn’t working for her anymore and decides to take the step towards improving her situation.
This is actually the hardest step.
There’s a lot of time investment and pride in a code base and it can sometimes be hard to take a step back and realise that the code base is cluttered and needs a good clean.
Additionally refactoring, especially on a grand scale requires time and resources which ultimately will lead to having to get buy in from stakeholders.
Once the right people are onboard the last step is to get in the mindset for tidying up so that the initial job is done well, but also that going forward that it’s easy to…