DEV Community

Cover image for Tidying Up Your Code: KonMari Style

Tidying Up Your Code: KonMari Style

Kim Arnett  on March 03, 2019

If you've been on Netflix, the internet, or talked to anyone recently, chances are you've heard of Marie Kondo or "that one tidying show", aka Tidy...
Collapse
 
marek profile image
Marek Zaluski

I find it works well to make small cleanups to a file or a function whenever you're already in the file to work on a feature or bug.

Leave the code a little bit better than you found it.

Tiny, incremental improvements add up.

And like you pointed out, code ghost can remain in a project long after it's no longer being used for anything. It's a great feeling when you can safely delete a bunch of old code and make the codebase smaller.

Collapse
 
qm3ster profile image
Mihail Malo

One of the biggest pitfalls of this approach is you end up with refactoring commits mixed with feature commits.
It takes discipline, organization, and understanding to put all of your refactoring first, then all of your feature, then more refactoring if you feel so inclined.

Collapse
 
kaydacode profile image
Kim Arnett 

Shoutout to @ben for his scout rule shoutout :D
dev.to/ben/the-boy-scout-rule-is-n...

Collapse
 
marissab profile image
Marissa B • Edited

Leave the code a little bit better than you found it.

Excellent way of going about it, just be mindful of changing too much and falling into the deep "Well I should just clean up this thing real quick... And that thing... Then these things..." pit. 🕳️

Collapse
 
jamesdengel profile image
James dengel

Yes, I prefer development to be iterated, recursive development leads to issues :)

Collapse
 
ben profile image
Ben Halpern

Great post. Bringing some concrete principles and metaphors is key to things as abstract as refactoring.

I want to give @andreagoulet for writing a similar post way before Marie Kondo hit peak popularity 😄

Collapse
 
joshcheek profile image
Josh Cheek

We can't go around killing off ugly code

Note that we can go around killing off process, so process is an especially great place to do this. In agile speak "Individuals and interactions over processes and tools"

Collapse
 
madisonkanna profile image
Madison Kanna

This is awesome. Thanks for sharing!

Collapse
 
grandemayta profile image
Gabriel Mayta

Uhm very interesting

Collapse
 
jaff profile image
Mark Jaffe

Where you wrote: "The idea with this challenge is not to go rouge and start rewriting..." I think you meant "The idea with this challenge is not to go rogue and start rewriting..."