Sunday, 25 May 2008

Knitting as Programming

OK, it's no secret that I'm a programmer by trade and although some don't like the term, I actually prefer to call myself a coder. This isn't because I think what I do is some kind of secretive practice, but because the attraction of problem solving is similar to that found in creating and breaking codes. I also accept a part of it is it's just a nicer word to say and a quicker one to type. You may consider that lazy, but I like to call it efficient.


I've done my job for around ten years now and in that time I've worked in a few different programming languages and focused my efforts on a number of different tasks. I've always worked on games, but I've covered areas from character control to user interfaces to tools development. It's been interesting and varied, but I think the coder's mindset is one that always wants to find new ways to practice it's art. This has led me to taking an interest in the internet and programming for the web. At least that's what's getting it's grip on me at the moment.

Using different languages and techniques helps you to develop a wider view of how programming works. It encourages you to think about how different styles and approaches suit different problems and it also helps you to learn the broader skills that apply to many forms of problem solving: patience, stepping back to see the bigger image and conversley recognising and honing in on the right details. I don't want to come across as overly philosophical, but rather to describe the background that's made me recently realise that knitting is really another form of programming.

To knit a garment from scratch you'd better start by planning it well. You need to think about who you're knitting for and then decipher what it is they actually want. Whether you're going to work on something for yourself or someone else, you don't want to get stuck in before you really know what you're hoping to end up with. In software engineering, this is called requirements analysis.

From watching my Knitter, I've learned that, the patterns she follows have a comparable structure to source code. They branch depending on variables, such as size, and they use loops where patterns repeat. You even find procedures than can be called repeatedly, such as those to make button holes and sleeves. Add to that the syntax describing which stitches to use and you're practically there.

The next step is actually running your code. This is where things get slower for the Knitter who has to do it all by hand, as opposed to us lucky coders that get to throw it all at a CPU and see what happens. Both methods lead to testing. I'm spoilt by having access to a team of professionals who are more than happy to put my work through it's paces, but my Knitter doesn't need all that. It seems the Knitters' way is to put it on, look in the mirror and maybe pull a few poses.

I think this is how she wins.

Cheers,
YarnBoy

3 comments:

Anonymous said...

I win!!!!

KSD said...

Requirements Analysis - thats what I've been missing! The latest sweater was fun to knit but makes me look like the Jolly Green Giant! I obviously need to put more focus on the requirements analysis before following the code. Thanks for the insight!

Ginger said...

Mum does XML in her last job. When we showed her this post, she smiled and said "Finally, someone understood". See, she's been battling with all the remarks about how she's wasting time with knitting. I'm going to do a post on Mum's knitting and link to yours. I think those who think Mum is wasting her time should think again. Thanks for saving Mum.