30
Sep
08

Programming: write it down (again)

Last day of last month, I talked about the importance of writing down your questions when you’re programming. Last day of this month, similar post – now, it’s about writing down your algorithms when you’re programming.

Since college (when I would “program” by the light of a desk lamp at the top of a bunk bed – pre-laptop), whenever I have a reasonably complex piece of logic to work through, I always start with a piece of paper and pencil, and I sketch out the entire algorithm in pseudo-pseudocode – basic structures, algorithms, control flow. (It’s like being at the board for an interview, but nobody’s watching.)

Why do this? In order of importance:

  • You can focus on the problem. When you’re writing real code, you’re focusing on a lot of things – the logic, but also the syntax and markup, the object-method structures, the tabs, the comments, the format. Each of those things takes some thought, and each moment causes a mental task switch from solving the real problem. (Maybe you’re both so talented and so experienced in a particular language and IDE that none of those things actually require any thought – you’re as fluent as you are in your native tongue. But I’m not, and you’re probably not either.)
  • It’s much faster. You might type faster than you write when taking notes, but nothing’s faster than writing fake code on a piece of paper, drawing arrows and braces to mark sections, using carets to insert content, etc. You aren’t worrying about any of the things above: you will find the problems in your thinking much, much more quickly.
  • You can do it anywhere. On the bus, by the bed lamp, when you’re pretending to make art with your three-year-old. You can think about the algorithm in between things and record your notes, rather than waiting for the moment you’re sitting down. Paper & pen are still more accessible and portable than the MacBook Pro.

Highly recommended approach. Let me know if this or similar things work for you!


1 Response to “Programming: write it down (again)”


  1. 1 Adam Jacob Sep 30th, 2008 at 9:42 pm

    I do this all the time. I sketched out a significant refactor today on the bus, on two pages in a notebook. In addition to the reasons you list above, I have a third:

    When I type, it’s in pass-through mode. It’s a conduit – brain thinks, hands type, screen shows characters. I hardly ever remember what I type. It’s true for note taking, and it’s true for drawing architecture: if I type the first draft, I won’t remember it nearly as well as if I write it down by hand.

    I had to start my own business to realize it, but there is no substitute for pen and paper of you want something to stick… at least for me. :)

Leave a Comment




Twitter Updates