DEV Community

Cover image for Knitting as Programming

Knitting as Programming

Abbey Perini on February 10, 2021

or how I learned programmers owe it all to fiber As part of my bootcamp, I was asked to present for 10 minutes on any topic. I've been c...
Collapse
 
crystalsolenoid profile image
Quinten Konyn •

Ohhhh wow!!! I am always daydreaming about this connection while I'm knitting. Following a knitting pattern makes me feel like I'm a little ant crawling through a big computer program one assembly instruction at a time. I get to focus on every individual stitch-- sometimes counting them, sometimes waiting for a stitch marker. But at the same time, I get to see how that linear, small-scale behavior is generating a complex three dimensional object. A while ago I put together a website to put this kind of stuff Craftinatorics, focusing on quilting and knitting. I lost momentum as its complexity caught up with my budding website-management/eleventy skills, but I've bookmarked this on my list of essential things to link to! Thank you so much for writing this, wow!!

Collapse
 
ruvans profile image
Ruth Evans •

Great post! I'm learning to knit and find myself translating the pattern into pseudocode to better understand, like I have to do a series of stitches until it's 20cm long and I think oh! that's just a while loop

Collapse
 
abbeyperini profile image
Abbey Perini •

Exactly! I also find approaching new stitches to be very similar. "Hmm... this output doesn't look right. What can I change?"

Collapse
 
tqbit profile image
tq-bit • • Edited

Great post, never thought about comparing these two. Yet

Knitting pattern designers follow DRY.

... you got me on this1. I never tried handling cloth (I've got a pair of left hands for any crafting, really), and maybe I don't get the message behind that bullet point - but isn't knitting quite a lot about repetition? At least for parts of the cloth?

Collapse
 
abbeyperini profile image
Abbey Perini • • Edited

I say knitting pattern designers follow DRY like I would say programmers follow DRY. Good pattern designers try to cut down on the repetition of instruction (code). You are correct in that the act of knitting and a knitted garment involve a lot of repetition themselves, but they're execution and output respectively.

You can tell when a pattern is written by an experienced designer trying to cut down on repetition. The best examples are the kinds of for loops and while loops I described, but it also includes intelligent use and creation of charts, a set of rows repeated until the fabric is a certain length, and how the instructions for different sizes of output are notated, among other things.

Collapse
 
rek990 profile image
Rebecca Key •

Great read! I'd never thought about it before, but I can definitely see the overlap.

Collapse
 
graciegregory profile image
Gracie Gregory (she/her) •

Love this post. Thanks for sharing.

Collapse
 
mikkelrask profile image
Mikkel Rask •

yarn install octopus-sweater

Collapse
 
teallarson profile image
Teal Larson •

This analogy is spot on! I love it!

Collapse
 
tian-sen profile image
DGJIAYAN Sweaters Manfacturer •

If you feel responsible you can choose a suitable knitwear manufacturer to manufacture sweaters & knitwear.