I frequently give the advice to developers that we should always be leaving the code cleaner than when we arrived. That we should be refactoring agressively to ensure the the code is in good shape. This usually brings people out who violently disagree with this and argue that we should never refactor without permission or that we should only touch the smallest amount of code to satisfy the new feature, no matter how ugly the system is.

The benefits to keeping the code clean should be obvious, so why do we see this reaction so frequently?

In my experience, it’s because these people don’t spend time improving their skill in a safe-to-fail environment. They only ever work in critical production systems where mistakes have consequences.

How do we get better at anything? By doing more of it. If we want to be able to make safe refactorings to keep the code clean, we need to do lots of it. The more practice, the better we’ll get. Except we won’t get that practice if we don’t have a safe-to-fail environment to practice in.

This is where coding katas come in, or coding dojos. Times and places where we can do deliberate practice to hone our craft. Safe-to-fail environments where we can safely learn from our mistakes and improve our skill.

So now the question is why do so many developers not do coding katas? Why do they not do deliberate practice, to hone their craft?

If we feel that we can’t safely refactor the code then we should ask why we never took the time to develop that skill.

If you’d like your teams to be doing deliberate practice but aren’t sure where to start, then let’s talk.