Knitting and coding, part 1

purple socks
Socks I made for myself

This summer I learned how to knit socks. And not just socks, but two-at-a-time magic loop socks. Which if you’d asked me two years ago, when I’d made a couple of scarves (and as it turned out, was actually doing the knit stitch wrong), whether I could’ve done such a thing…I’d’ve been exceptionally skeptical.

When I started that project, I didn’t know anything about sock construction, and I’d never used the “magic loop” technique. And even with a group of fellow knitters working together, I just got too frustrated (there was a LOT of cursing, and not just from me). So I used one of my favorite debugging techniques: picked out the smallest possible piece of the project, and figure out what’s going on with that. I made a coffee cup cozy, so I could understand the magic loop part. (Magic loop involves doing some weird stuff with a reeeeeally long circular needle instead of several double-pointed needles (DPNs). It’s actually easier in the long run than using DPNs in some ways, but it’s a different way of thinking about the creation process.) That got me to the point where I understood enough to try two at a time, and socks start out as just plain old tubes, so that gave me enough time to get really comfortable with all of those parts before I tackled the weirdness of sock heel construction.

The first time I made a sock heel (which in this particular style has three components: a flap, a turn, and a gusset), I was basically just following along by rote, as I’ve done many times particularly with JavaScript. “Cargo cult coding” — just copy this thing and if it works, it works, if not…who knows? The sock heels were the same way, reading the instructions very meticulously and just doing exactly what they said.

I’m on my sixth pair of socks now (although that includes two pairs of baby socks for my nephew), and now I understand the process and the technique enough to even second-guess a pattern or make up for a mistake I may have made earlier. (Or most importantly: how to adjust a pattern designed for DPNs to magic loop.) There’s parts I can’t always keep straight in my head, not unlike knowing that a function exists but not being 100% sure how it’s spelled or whether there’s a underscore. (Damn you, PHP.) Which side of the sock gusset should be SSK and which side should be K2tog? Sometimes I just have to do one and see if it looks right. Sometimes knitting could really use code hinting…perhaps the material itself is the code hinting.

With every new technique (language, stitch, etc) I’m full of frustration and self-doubt: nothing makes sense, I can’t believe this could possibly work, I’m not smart enough, dextrous enough, etc., etc. I cuss at the materials/tools, myself. And then it just CLICKS. I don’t know how that happens, really, although a lot of it is getting the right help.

I’ve learned over time what kind of help works for me. I had the worst time learning JavaScript. THE WORST. I was a full-time webmaster, writing quasi-applications in PHP, and I still couldn’t make heads or tails of JavaScript. It was the saddest cargo-cult coding when I even tried. Then I read DOM Scripting (mostly on a looong bus ride from Lakewood to Auburn, IIRC) and it made the critical connection I’d been missing, which was to tie it to something I understood really well (HTML) AND to use it in contexts that I actually needed.

Similarly, the whole Ajax thing seemed sort of strange and magical and confusing — and then I was a tech reviewer for Adding Ajax, and that connected what I already knew about writing little PHP things to the JavaScripty bits, and I realized it actually wasn’t that big a deal. I mean, yes a big deal that it can be done, but not as huge as I’d made it out to be.

I mentioned earlier that I spent the first few months knitting wrong. For the knitters in the audience, I was knitting into the back of the loop; which is a subtle enough mistake that it doesn’t look totally wrong, especially when you’re just learning it at all. But it throws off the gauge and the feel of the knitting, so things don’t fit quite right. And it also meant I had a hard time understanding how to increase stitches, which is what I was trying to learn when I discovered my problem. And what I discovered, in addition to the solution to my problem, was the kind of learning materials work best for me with knitting.

Surprisingly enough: not video at all or photos generally, but the right sort of drawing, ones that show the three-dimensionality of both the yarn and the needles (and fingers, to be honest). Along with text that uses the things I already know, written clearly. Not unlike what I need from coding help.

I’ve been sitting on this post for a couple of weeks, so I’m just going to leave it here. There are some other connections in my experience of both knitting and coding, that I’d like to write about later:

  • Picking patterns is a lot like picking modules, plugins, and other open-source tools.
  • Craftsmanship in general, knowing your tools and materials.

3 Replies to “Knitting and coding, part 1”

  1. I back-knit for years until “caught” by a teacher at a class for knitting in the round. So happy I’m not alone! One other thing JS and knitting have in common: if it works we tend not to question if it’s the right solution, and nobody cares if you back-knit that garter-stitch scarf 😉

Comments are closed.