I spend a lot of energy on the coding equivalent of the mantra "cleanliness is next to godliness".
People sometimes think this is extra work but it's not. In fact, it's anything but that.
Fastidious coding is frontloaded work. That is, I'm taking the thing that I know is hardest - keeping my design natural to my problem - and doing that work as soon as I can.
When you do that, code-cleanliness work doesn't start to stack up into a seemingly insurmountable pile.
That psychological effect, alone, is worth the "effort" but there's a subtler, more potent source of value.
Badness compounds on badness. When you let code be bad, you do bad things to get it to work. That makes the code worse.
So, allowing a quality problem to fester not only accumulates redesign work into large chunks but also accumulates work you would never have had to do if you just kept things clean.
Following is a video wherein I spend about an hour cleaning up a test library, among other things. You can think of it as a waste of time or an expression of my perfectionism if you want to, but I would like to offer a different perspective.
What if you watch the video and try to think about all the things that could go wrong if I didn't do that cleanup, this morning?