Algorithms on a Napkin

When I have trouble figuring out an algorithm I usually opt for a diagram in a program like Dia or on paper. A few days ago I was having a difficult time getting room saving to work properly in Constellation so I decided to draw it out. This time I didn’t use a flow chart or a diagramming program, I just used a napkin. In a few minutes I had sketched out the entire algorithm as it was going to be used in the program instead of building a set of flow charts I would only use once.

I didn’t need a big flow chart and a detailed plan of the algorithm, I just needed to see it. The sketch helped me visualize the steps. It let me refine the idea as I was working through it and spotting design flaws. Sometimes that’s all you need – A pen and paper to be your (very useful) rubber duck.