This is a guest post by M.K. Carroll, Crochet Editor at Cooperative Press and Knit Edge magazine. Have something you’d like to share on our blog? Drop us a line.

It’s a popular hobby, practiced by people all over the world. At its most basic, it’s a loop of string and two pointy sticks. The loops can be combined in various ways to create a wide variety of things, from the practical and useful to the whimsical and just plain weird. In other words, knitting is a lot like coding.

Say what?

*k2, p2, 2/2 LC; rep from *, end k2.

What you see above could be described as a line of knitting code: a set of instructions that you can use to execute a row of knitting. Combined with additional lines of code, these instructions (commonly referred to as a knitting pattern) can be used to create a recognizable item, such as a sweater or a pair of socks.

Knitting — like coding — gives you the freedom to create

You can buy a sweater ready-made with a lot less effort than it would take to knit one, but there are a lot of reasons why you might want to knit that sweater yourself, like having one that fits you perfectly. You could also spend a lot of time trying to find one to buy, or a lot of money getting someone else to design and knit it for you. Sometimes – like learning how to code – learning how to create is how you get exactly what you want.

One line at a time…

Knitters and other "yarncrafters" (like crocheters and weavers) understand what it means to build something one stitch (bit) at a time, and yarncrafting pattern designers (coders) know what it means to code, use an API, design, test, debug, and maintain the source code – even if they don’t realize it yet. Daniella Nii says that:

"Just as in coding, attention to detail and syntax are crucial to a successful execution of a pattern (program). An overlooked parenthesis, comma or repeat can result in a piece of code that doesn’t compile and will interrupt the flow of the program, possibly discovered when the next line of instructions will not work with what the knitter has on the needles."

Knitters know how to learn and "speak" a different language already, and learning how to code could mean being able to design and build the knitting app they want, without having to hope that someone else will. Not bad for something that starts with two sticks and some string!

Know how to knit? Learn how to code!

If you are a yarncrafter, you are already predisposed to learn how to code. Do you think it would be awesome to play a video game based on knitting? You can learn how to make one. Would you like to sell your crocheted mustaches on your own website? You can learn how to build a website and storefront too. Do you think PlaceKitten is an awesome API, but would be improved with yarn? You can learn how to use APIs to make the app that you want, instead of settling for an app designed for someone else.

Know how to code? Well…

If you are learning how to code and enjoying it, you may also enjoy learning how to knit, crochet, or spin. After all, if you want to build a website to look and function in just the right way for you, you may also be the kind of person who would want to knit a pair of Dalek patterned mittens that fit you perfectly.


Thanks to the yarncrafting coders LeTonBeau (on Ravelry.com), Daniela Nii (nikkisstudio on Ravelry.com), and Megan of stockinettezombies.com for volunteering to check my analogies and make sure they were accurate!

Related articles

7 articles
what-is-open-source-1.png?w=1024

What Is Open Source?

09/22/2022
8 minutes
By Codecademy Team

Learn why developers and companies love open source software and how to start contributing to open-source projects.