I've been thinking a lot about cross stitch and coding this week and how they're connected.
Cross stitching - the back
When you cross stitch you're creating something that'll look good, framed on your wall. But the back is important too - it should also look good. If you look at the back of a cross stitch you should see vertical lines.
Why is that important? Partly because it's the mark of a good cross stitcher, and it's a mark of pride that you've done good work (at least it is for me).
But it's also to make sure nothing shows through on the front that you don't want to be seen. For example, if you do a stitch on one side of the material, then do another stitch on the other, the thread hanging between them might be visible through the holes between the stitches. You don't want that.
It's also because it's more efficient. Good cross stitchers use less thread. They then build up a massive collection of threads left over from kits, which somehow never seems to contain the right colour, but that's a separate problem (see cover photo).
How does this relate to coding?
The front of cross stitch is like the part that the users see. It looks pretty and it's obvious what it's meant to be. The back of cross stitch is the actual program - the part that only developers see. And it should also be pretty and obvious what it's meant to be.
Just as with cross stitch, where you should be able to look at the back and know where you are, you should also be able to look at your code and know what it's doing.
It's a skill you learn as you go on. As you get better at cross stitching you'll get faster and more efficient, and the back will look prettier. As you get better at coding you'll get faster and more efficient, and your code will be prettier.
But there's one way in which coding is better. When coding you can go back and make the code prettier later (aka refactoring). Once you've done your cross stitch, it's done. You don't unpick it to make the back look better (not least because unpicking makes the thread fray and you'll end up using twice as much).
Other ways cross stitch teaches us about coding
Too much of one thing is not good for you
We're all familiar with the threat of RSI from too much keyboard usage. But it's not the only way you can get it. I have RSI from too much cross stitching. It's a lesson that doing something a lot is not good for you, even if you really enjoy it.