Crafty Coding: Hello World

I am a knitter at heart. If there’s something I have to do, I would rather be knitting.

It was 2012. The yarn addiction had not yet corrupted my brain.

My aunt taught me how to knit in the car while we were driving to the circus. She gave me metal needles and a ball of pastel pink Red Heart Supersaver acrylic yarn. My first project was a long, garter scarf with dropped stitches tied into knots.

It was beautiful.

Nothing before had silenced my mind like the hypnotic rhythm of knit 2, purl 2.

Learning to knit kickstarted a habit of teaching myself new crafts. At 13 I got my own YouTube account and taught myself crochet, bookbinding, sewing, embroidery, and papercrafts. If there was a YouTube video on it, I gave it my best shot.

Crafting became a part of my identity.

I was an artsy teen. When I was in high school, the message was very much: STEM vs “The Arts”. It’s not that I didn’t like math, science, or technology-based skills. I just liked writing, knitting, theater, music, and crafting more. Part of me bought into the idea that I had an artist’s brain.

But that exact brain, the one that thought in:

“k2, p2, k1tbl, *k2, p2* repeat until end of round”

was the exact brain that would love computer sciences, especially coding.

But no one told me that. It wasn’t until this year that it finally clicked.

I would be great at coding.

I fell down the rabbit hole of knitters-turned-coders and was amazed. The internet is filled with people who claim that knitting made them better coders and that knitting patterns resemble code in many ways.

The Similarities

Knitting is processing an algorithm.

When I pick up my needles to knit, I am the computer and the pattern is the program. I am given code to translate line by line (or row by row) into an output.

Sometimes I make mistakes (bugs) when I drop loops or make the wrong stitch, and they need to be identified and corrected (debugging).

Knits and purls are like 1’s and 0’s in binary code. This binary code can be consolidated into symbolic language that is easier for humans to read.

The language of knitting patterns is unreadable to non-knitters but universal to knitters. Knitters can decode and translate the instructions into similar results.

Conversely, I can become a coder (designer) and create a program (knitting pattern) for other computers (knitters).

When I wrote my Cosmic Latte Socks pattern, I followed the same steps I would if I wanted to create a program.

  1. Identify the Problem
  2. Design a Solution
  3. Write the Program
  4. Check the Solution

First I identified a problem. I wanted a hand-knit pair of socks with an all-over dip stitch design. These socks didn’t exist, so I had to write that pattern.

Then I had to design a solution. This involved envisioning what I wanted the finished socks to look like, drawing a diagram, and choosing what techniques to use in the pattern.

Would I use a 1×1 rib or a 2×2 rib?

What heel structure would fit the design of the sock?

Would I knit these socks toe-up or cuff-down?

Once I had my design, I began writing the program (pattern). This involved three steps:

  1. Coding
  2. Compiling
  3. Debugging

When I begin to write a knitting pattern, I have to take the design in my head and translate that into a sequence that other knitters can read line by line to produce the same output. There are two ways to convey this information.

Knitting charts are similar to the binary code that computers understand. In a knitting chart, each box represents one stitch and within each box is a unique symbol. A legend or key will tell you what each symbol represents. The numbers on the right or the left side will show you the rows, while the numbers on the bottom or top will help you count the stitches.

This style of knitting pattern is most similar to binary code and is the more intimidating of the two types of patterns when you first start knitting.

I write and read patterns in a way that is most similar to how a human would code. Written instructions are explained row by row and communicate to the knitter what each stitch should be in the most efficient way possible.

This example is not from my pattern. It is just some random instructions I came up with:

Row 1: k all sts.

Row 2: p to 1 st remaining, p1 into the st below.

Row 3-6: *k1, p1* repeat from *-* to the end of rnd.

Repeat Rows 1-6 until your piece measures 6 inches.

By writing as efficiently as possible using looping instructions, abbreviations, and references back to earlier instructions, the pattern becomes easier to read and simple to execute. The optimization process is driven by DRY (Don’t Repeat Yourself) and results in a program with as few, simple lines as possible.

After I finished writing the entire pattern, I gave it to my knitting friends to test knit. This process is similar to compiling. They knit the pattern as I wrote it (compiling), identified mistakes (bugs), and returned their findings to me for revision.

I then coded > compiled > debugged until there were no more mistakes in my pattern.

Finally I “checked the solution” or tested that the pattern did what I wanted it to do. Ideally, when I released my Cosmic Latte Socks pattern into the world, a random knitter could make my pattern following my exact specifications and produce a pair of socks identical to my original design.

Check out my Comic Latte Socks pattern: Etsy, Ravelry

Crafting My Way Into Tech

This year I am ridding myself of limiting ideas. By branching into coding I am challenging my creativity, problem-solving, and my own self-perception.

I set a goal to code for 30 minutes every day this year, and I hope to make some fun projects with my new coding skills.

Check out My 2023 Roadmap where I lay out my goals for the year.

I am learning Python on Treehouse and will be tracking my progress here on this blog.

I am calling my journey “Crafty Coding”.

If you are a knitter and want to join me on this coding adventure feel free to follow along. If you are a coder turned knitter, I would love to hear about your experiences!

Without further adieu:

print(“Hello world!”)

3 thoughts on “Crafty Coding: Hello World

  1. I was (am?) an engineer probably with some ADD. Wish I had found knitting sooner as it really fits and soothes my brain. Love your comparison to coding. Best wishes in your coding career. Love your Comic Latte Socks.

    Liked by 1 person

    1. Thank you so much for sharing! It is amazing to hear from someone with the opposite experience as me. Knitting is so comforting in so many ways but equally challenging and technical. The more I discuss this topic the more people I meet who have made the same connection. Love your blog!

      Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s