samedi 5 décembre 2020

Poise

The most difficult thing about coding is not 1) arcane stuff 2) logic or 3) bugs. It's finding entry. You could stare at code all year. Until you go, "Ok, I'm gonna change something and see what happens," you're K I N D A N O W H E R E.

Coding is more like music than writing. Until you play some notes, it isn't really music. Constructing the logic is a duet or dialogue. Dialogue is never just staring, nor is it only staring and writing. Dialogue is two or more sides actually speaking, and to each other.

Whenever I've been stuck on a big project for weeks and seem to have written nothing, you know what I do? I hit the run button. I watch it run and prod it this way and that. Then I change something, and run it again.

You feel way too stupid to understand the code (even when you wrote all of it) until you engage with it like this, in my experience. Once you do, quickly you find you're back in the mental space that wrote the code. You didn't get any smarter in a minute. You engaged!

The other central lesson, which you'll probably have to learn over and over and over again, even after you start telling people it's the central lesson, is that getting upset under no circumstances helps you solve a code problem. The solution is always the same: get curious, test your assumptions, put in sanity checks, the most basic ones first. Ask yourself, "What's the dumbest thing it could be?" and almost like magic, it's often exactly that, because that's what you were overlooking.

Our first instinct when there's a problem is to get hyperactivated. Then we think we need to get sophisticated. With code, the approach is calm and simplicity.

That does not, of course, mean that code doesn't get super hyper (it runs fast) and elaborate (you could spend many lifetimes learning complex code patterns). But as they say in the Marines about dismantling, cleaning, and reassembling firearms: "Slow is smooth, smooth is fast."