People often stumble while trying to find metaphors that explain what, precisely, writing computer code is like.
In "Code Like a Weaver", the software developer Kristina Taylor notes that she got all her conceptual framework from her mom, who exposed her to baking, laundry, and weaving. Baking taught her fractions and math; hanging the laundry taught a concept uncannily like the "software stack"; and weaving is about as algorithmic as things get.
As Taylor notes, the 19th-century Jacquard Loom — which was fed weaving patterns via punch-cards — set the stage for the idea of feeding instructions into obedient machines, and watching abstracted patterns rendered onto the world.
Lately, Taylor's been using her personal loom to weave Swedish lace, and she prototypes her patterns by taking the structure of Swedish lace and emulating it using cell formulas in Google Spreadsheets:
My loom is a fairly simple 4-shaft, 6-treadle counterbalance. I've currently got it programmed to weave Swedish lace.
To decide how to thread the loom and what treadling pattern to use, I took the basic structure of Swedish lace, and fed it into a google spreadsheet. The first 4 rows across the top define the threading: which warp threads go through the heddles on which shafts. I used the first 8 columns in the spreadsheet to play with treadling & tie-up patterns until I got an overall fabric structure that I liked. It turned out that I only needed 6 of the columns for the patterns I wanted to do, which is great — because I only have 6 treadles.
Without changing the threading of the warp, a different treadling pattern (algorithm, really) in the columns on the left results in a substantially different structure to the weave.
She's got great pictures in her post showing how the pattern turned out in reality.
This is, of course, delightfully meta: Jacquard weaving leads to computation that leads to spreadsheets that catalyze more weaving. But it also reminds me that spreadsheets themselves are an often-unremarked gateway drug into programming. I've talked to dozens of software engineers who first got fascinated by algorithms and computation while working in some job that required them to create byzantine Excel spreadsheets. They crafted so many wildly complex if-then dependencies that when they decided to try learning programming itself, it was second nature, intellectually.
Elon Musk and Stephen Hawking are worried about humanity-killing AI emerging in some secret high-end research lab, but personally I'm expecting the singularity will erupt from a 5,000-by-5,000 actuarial spreadsheet — created in the underbelly of an insurance company — that accidentally achieves sentience.