Patterns & Programming

As I began a new crochet project, following the pattern provided, I began thinking about the parallels between knitting/crochet patterns and computer programming.

I am learning one client-side programming language, JavaScript, and a system-side programming language, PHP. In PHP you learn commands and then start building loops and functions. Loops are repetitive programming actions. When learning programming you are learning a new language and taking note of the sequential steps that must be taken for the programming to work correctly. A most telling comparison between the pattern making and programming is that both are only as good as the creator. Some other thoughts:

  • Learning commands in any programming language (e.g., $var, <hr>, $i++) is the same as learning the short-hand and accompanying actions in knitting or crocheting (e.g., k1, 3 dcs, purl 2)
  • Running a loop (e.g., “for loop” or “while loop”) is the same as repeating a sub-pattern within the larger pattern (e.g., “continue 3dc, ch1, 3dc, ch1 for each corner”)

Here’s an interesting blog on “A Computational Model of Knitting.” I’ve had this bookmarked for a while to read and when I do, I’ll update this post.