Saturday, November 14, 2009

Knitting & Testing

This afternoon, I dropped by while James Bach was signing copies of his latest book, The Buccaneer Scholar. Somehow I mentioned that I knit, and he explained one of his new teaching ideas, that test script writers could learn a lot from the way knitters write patterns. It's common to write test scripts so that anyone could read and execute them. But a knitting pattern is written for the (more-or-less) knowledgeable knitter, who is already familiar with a number of abbreviations and other conventions in knitting patterns. Just as it would be incredibly tedious to re-explain how to ssk (slip-slip-knit) every time that stitch is required, we could perhaps save a lot of tedium in our test scripts by developing a common jargon within a testing community[1].


[Edit: In the following paragraph, I completely failed to mention the contributions of @superpuppy, who shares with me an interest both in knitting and in breaking software.]

Then James sent me on a mission to find 2 books -- one that just assumed you knew knitting and used its jargon, and another that provided the introduction needed to understand and implement the patterns in the more advanced book. I found some books for him (5, since I'm an over-achiever), but the process sent me in 3 other directions as well:


1) The books on that shelf were not the intro ones I would have recommended if I was picking from all knitting books ever. While the Borders' collection of knitting books was respectable for a mall-sized chain bookstore, the selection felt limited compared to a yarn store or the internet. The main book I referenced while learning to knit was the Vogue Knitting Quick Reference. For crochet, I used 10-20-30 Minutes To Learn To Crochet.[2] The books I did offer James were still reasonable intro guides, covering the jargon and formatting of patterns. The crochet intro explained not only the cryptic terminology, but also the standard way of diagramming crochet. (The knitting may have taught how to read knitting charts as well, though I didn't notice it.)


2) There are a lot of parallels between knitting books and software testing texts. There's the plain old pattern collections, like test scripts. Then there's books that talk about what to do when things go wrong. And just as a tester may turn to hardware documentation while testing software that runs on it, so a knitter might find a book exclusively about various types of fibers instructive. At first I thought this was because the two crafts are similar, but perhaps it's more because human beings learn different skills in similar ways.


3) It feels like there's a lot more connections between knitting (and/or crochet) and testing than just the idea of how to write up scripts that James identified. I'm going to start a list here, and I hope you'll join in by commenting below, or tweeting me.


- A pattern is a test case/script. There's a set of steps, and an expected output.


- Keeping track of exactly what you've done so far is important. Count your rows, log your actions.


- Following the pattern/script exactly is a reasonable first step. But variation is good too! Try a different yarn and finishing stitch. Try it using the mouse instead of the keyboard, or with a bigger input file.


- When you diverge from the beaten path, keep track of what you did, so you or someone else can do it again later.


- There are books that can teach you how to do this stuff. But a workshop (at Weaving Works, or PNSQC) can be so much more effective. There are also videos (how to knit a mo√ębius, how to test an Easy button).


- There are heuristics. The Knitting Stitch Bible is nothing but stitch pattern heuristics -- no patterns for whole garments, no 'how to knit and purl' at the beginning, but 39 ribbing variations and 37 cables to choose from. I have yet to find such a concise book of heuristics for software testing, though I do find individual heuristics scattered all over the internet, and James gives great detail about a few in The Buccaneer Scholar. (Why isn't there an encyclopedia of testing heuristics?)


- There are holy wars, based on over-generalizations, imprecise terms, and uninspected biases. Knitting is more refined than crochet. Automated testing is more rigorous than exploratory testing. Well, what do you mean by 'refined', and is that necessarily a good thing? What do you mean by rigor? Or automated?




[1] A community could be a project team, department, company, formal or informal intellectual group, etc.

[2] This book deserves special note as the only intro book for crochet I've ever found that respects left-handed students. Most books show the first diagram or two redrawn for a left-handed context, and then expect you to just reverse the right-handed diagram for all the other techniques they teach. 10-20-30 includes diagrams for many (all?) of the techniques where hand positioning is important.


7 comments:

Victoria Wang said...

Great insights! Love the connections between knitting and testing—I enjoy thinking about how software parallels various forms of art.

Kazarr said...

Give me a good thinking. Also helps to explain testing to non-computer people.. would be interesting to see, if this pattern sticks to more general examples as well (since i have no clue as such about knitting :-) ).
First thing comes to mind... music "making" .. dont they learn with chords and notetables as well?

Cheers,
Kazarr

B J Osman said...

Thanks you for the connection. I must admit that I had not seen how closely aligned knitting and testing was and what a wonderful metaphor it is!

This could make for an interesting conference talk!

BTW - I will not look at a needle and threat the same again :)

simi said...

First of all. Thanks very much for your useful post.

I just came across your blog and wanted to drop you a note telling you how impressed I was with the information you have posted here.

Please let me introduce you some info related to this post and I hope that it is useful for software testing community.

There is a good Software Testing resource site, Have alook

http://SoftwareTestingNet.com

simi

Mamma Spice said...

I hopped over here for testing and found one of those things I am always looking for-- knitting or crochet resources for the left handed.

Is there a community you would recommend for testers which is similar to how Ravelry functions for knitters?

I have found that online and in person community support for knitting has made me more adventurous, more curious, less fearful as a knitter. I could use all those things as a tester.

Lizard said...

So glad you found it helpful Mamma Spice!

As far as testing resources... Lately I've been following a number of bloggers and twitter posters. (I should probably add something to this blog about that -- a blogroll in the sidebar or a post with links, maybe?)

Depending on where you're located, you may have some great testing groups or conferences available. I went to PNSQC (Pacific Northwest Software Quality Conference) in October, and am thinking about STAR West this summer. (There's also a STAR East on the other coast of the US.)

Here in Seattle, there are two regular QA groups: SASQAG and QA SIG. (Though I haven't made it to QA SIG yet.) If you live in a large or tech-minded city, there will probably be one in your area.

I recently discovered www.softwaretestingclub.com, which at first glance feels a bit like Ravelry, though I haven't dug into it much.

Rose said...

It was very interesting reading. I love Crochet and linking that with Testing seemed real fun. Thanks for this!
However I feel Crochet is limited, with few basic knots, testing has no limit... you can't just say follow 1,2,3 and you get the test coverage ( pattern) :( Testing the not that simple. I never get that satisfaction as I get when I'm done with a set of Crochet instructions ending with a beautiful pattern with testing...there is always something that is left...