Knitting as programming

I’ve seen a few people, over the years, compare knitting to programming. It usually goes something like this:

Wow, have you ever looked at a knitting pattern? It looks kind of like source code! Those knitters must be real geeks!

And it’s often accompanied by a snippet of a set of actual knitting instructions that look like incomprehensible gibberish to the uninitiated, but which your grandma could probably read and turn into a jumper or a scarf or an attractive toilet-paper-roll cover (my Nanna actually knitted these!)

In case you haven’t seen this kind of knitting pattern before, here’s an example:

1st Row: P. 3, * k. 1, p. 1, k. 1, p. 3, repeat from * to last 4 sts. (k. 1, p. 1) twice. etc.

A typical knitting pattern from the 1940s. This one is Sun-glo pattern #2616, "Country Club", a sporty cabled sweater in two colours, in case you were wondering.

There was even a post a little while ago entitled Knitters and coders: separated at birth? that talked about knitting patterns as code, and worked through some examples using regular expressions. It was a good post, but I don’t think it went far enough, so I want to riff on it a bit.

Here’s the thing. Let’s say you have a pattern that says:

row 10: k2 p3 *(c6f p6) rpt from * 8 times c6f p3 k2

(Or as the aforementioned article would put it would put it, (c6f p6){9}.)

You read those instructions and do what they say, producing a row of knitting that incorporates a number of cable twists against a purl background.

Is what you’re doing programming? Of course not! It’s the reverse of programming: you’re reading a series of low-level instructions and doing what they say. It would be more accurate to say you’re an interpreter, or possibly a compiler, since it’ll usually save you time and trouble to read a pattern right through before you begin. (Ask me how I know. Ugh.) You might even be called a human computer.

But let’s be clear: even though what you’re doing when you read a pattern is a complex technical skill, and involves code, it’s not programming.

Despite that, I very firmly believe that knitting is like programming. I just think that the common analogy drawn — of printed knitting patterns as source code — is not a very good one for describing the intellectual process of knitting as it is practiced by the current generation of geeky crafters.

Continue reading