Monday, July 16, 2012

Always Explain Your Code

I'm having problems with my knitted code.

I'm trying to make a 9"x9" square, so of course an important thing is to have the initial set of stitches come out to be something that's 9 inches long. I have a pattern which specifies the use of a certain number of stitches to achieve this, but people don't knit exactly alike--some pull the yarn tighter, some leave it looser--and I personally never get the right size by using the specified number.

Generally I have to add more, but how many more depends on the pattern.

This square has a repeating pattern, so you can add a certain number of stitches to get another instance of the design, but the number of stitches per pattern-iteration is 14, which is a lot. I'm only about 4 stitches (and half an inch) short of 9 inches, and when I added 14 stitches it was 10 inches, easy.

The annoying thing is that you always have to knit several rows before you have enough of the representative fabric to get an accurate measurement. You have to run the code for a while before you can tell what it's doing, we might say.

This is probably fascinating to exactly no people, but here's the thing I should have learned from practicing coding, but didn't: comments!

I've knitted this square before, so I must have solved the problem somehow. I should have written a note on what I did. Presumably added some number of non-pattern stitches to the edges, but how many? I'll have to knit it again (4th time's the charm?) to find out.

Or possibly just give up in irritation and try some other square. Which I also will not know how many stitches to use for, but at least it'll be a change of scenery. You get tired of knitting the same first 6 rows over and over.

No comments: