Code should start out messy

Earlier today Antony said on Twitter:
“stop apologising if your code starts out messy… it’s how it ends up that counts…. you can’t make an omelette without breaking some eggs”

I replied:
“Code _should_ start out messy. Finding the right places for things is harder when they’re already neatly in the wrong place”

If you have a preconceived idea of where your code should go, you will put it there by default. Antony told me an experience he had with this when he was untangling dependencies in jnarrate. By moving everything into a single package, then repackaging based on affinity, a much better package structure revealed itself.

At home, I would really like to re-organise my kitchen so that the pans are closer to the cooker. It makes sense from an ergonomics point of view. However, they already have a home. In order to rearrange the pans, I would have to empty the existing cupboard and the destination cupboard. It’s less work for me to put the pans back in their existing space, but it bothers me whenever I think of it. I really should fix that