Stefanie Ward, August 11, 2016 | 2 min read

Undoing and Redoing

Before I learned to code, I learned to knit. The two activities have a lot in common. Knitting has a limited number of stitches; coding, a limited number of commands. With these limited blocks, people build massive projects with a dizzying array of possibilities. Both start with easy projects that are easy indeed and progress into more complex projects that discourage the beginner. And both are remarkably easy to ruin late in the game.

As a beginning knitter, I would respond to any bad mistake by destroying the project and starting over. If I dropped a stitch in a way that could unravel three feet of scarf, then unravel three feet of scarf I would, right then and there. If it wasn’t perfect from the beginning, it wasn’t worth saving. By the time I moved beyond scarves, I stopped making mistakes on that scale, and I accepted the smaller irregularities without ever considering whether they could be fixed.

The first time I taught a knitting class, this method fell apart (worse than any of my scarves!)

My students, a handful of eager middle schoolers, didn’t have the time to redo three feet of scarf every time they made a crucial mistake. They only had the time to undo down to the mistake itself and start from there. It was left to me, the experienced (if not expert) knitter to try to salvage the rest. Now, knitting is pretty unforgiving on this front. It’s very difficult to recover from a hole unless you 1) unravel past the hole, 2) unravel to an even, exact line of stitches, 3) distinguish those loops from the loops holding them in place, and 4) keep your clean row from falling apart while you 5) gently nudge the knitting needle back in place. Oh, and even if you do all these things perfectly, you’ll usually twist a few stitches in putting them back on, leaving a subtle scar in the fabric.

It would have been so much easier to start over.

But after a few times salvaging my students’ projects, I noticed something.

I could now tell the difference between the loops that were stitches to put back in place and the loops that should be left alone.

I could now recognize a dropped stitch before it became a hole later on, and I could usually fix it before it became a problem.

I could even tell by the angle of the loops whether they were twisted or straight.

I learned so much more by fixing mistakes than by getting it right the first time.

You’ll see where I’m going here. We’ve gotten into the frustrating stage of coding where simply starting over isn’t a great solution, but fixing mistakes can lead to worse mistakes, and ends up in scary, ugly places. But even now, I’m understanding more and more by fixing mistakes than I would ever understand by getting it all right on the first try. I look forward to the day when I recognize the pattern of a rails app as intimately as I recognize a stocking stitch.