Wed Jun 16 2021

Change your code often

Just change it. It doesn't matter how, just get yourself in the habit of making changes. Big changes and small changes. The more you change your code, the more patterns you'll see. You'll get better at noticing the difference between brittle and flexible code, and you'll start writing code designed to be changed.

When we build software, we spend time making it nice and elegant, thinking it will last a while. We think if our code is clean enough it will withstand the test of time.

It won't.

Someone might rewrite it or rip it out completely a year from now. Or a month from now. Or tomorrow. Not because it was written poorly, but because it needs to accommodate a new feature, or fix a bug, or because it becomes part of a legacy system.

In fact you might be the one changing the code, either yours or someone else's. Picture it. Picture yourself looking at a screen full of code, trying to figure out where to make the incision. How are you feeling? Confident? Uncomfortable? Afraid you'll break something?

My advice: change your code often. It will get you in the habit of seeing code as malleable, a powerful habit for writing clean code. Clean might not mean what you think it means, clean means changeable. Code is a living organism, never finished, only resting. Changing it often keeps this top of mind.

When you're not afraid to change code, you're not afraid to ship code. It might not be perfect forever but it will fit the current use case. When you need to optimize it later or fit a new use case you'll open it back up and thank yourself for making it nice and easy to change (the tests you wrote will also help of course).

There's a fabric of patterns underneath changeable code, and if you don't do it you won't see it. Go make some changes!