In his recent post “Forget about Clean Code, let’s embrace Compassionate Code”, Johannes Brodwall writes:
I don’t believe we should use TDD because it’s a professional obligation. Instead I use TDD when it makes my work more enjoyable. I don’t think we should refactor our code because it violates a SOLID-principle. Instead I sometimes reach to a principle to understand why some piece of code is hard to change or understand. I don’t want to shame people for writing Unclean Code. Instead I believe in having an honest dialog among equals about how we want our code to look. I don’t believe that professionalism should compel us to introduce tests for all untested code. Instead I believe we should prioritize which deficiencies we fix and which code monsters we allow to live out their lives in their part of the code base.
It reminded me of Sarah Mei’s talk Livable Code, where she drew comparisons between living in a house and working in a code base. (I’m convinced it’s the most apt metaphor in the history of metaphors.)
One of the points she made is that it’s just as hard to live in a house that’s too clean as it is to live in a house that’s too messy. There’s nowhere to put your stuff.
When I saw her talk, it got me thinking about my parents’ house, which is always very neat, clean, and uncluttered. Not too much—it’s certainly livable—but neat enough that it’s striking. However, there’s always been one room where all the clutter goes. For years it was the guest room, and then it was the garage.
I wasn’t sure how this fit into the idea of clean code, but I was sure it did somehow.
Well, a little while ago, Betsy Haibel made the case for having a space in your code named “junk drawer”.
Haven’t tried it yet, but I like this idea. At least a drawer filled with junk is more manageable than a whole garage.