Write Little Proofs in Your Head.
Matthew Prast (14 July 2025)đź”— https://blog.get-nerve.com/to-be-a-better-programmer-write-little-proofs-in-your-head/
âš“ #programming-languages #functional-programming #bcs2220 #bcs
The importance of (and tricks for) doing proofs about code you’re writing as you write it:
This is a brief write-up of a trick I learned that helps me write code faster and more accurately. I say “trick”, but it’s really something I started to do without noticing as I moved further into my career.
When you’re working on something difficult, sketch a proof in your head as you go that your code will actually do what you want it to do. A simple idea, but easier said than done: doing this “online” without interrupting your flow takes a lot of practice. But once you get really good at it, you’ll find that a surprising amount of the time your code will work on the first or second try. It feels a little magical.
