Archive for the 'protip' Category


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!


Programming: When you’re stuck, write it down

Hey. Long time, no blog. Been busy.

Thought I’d share a tip that I’ve used for many years when programming (or learning almost any new thing) and I’ve been using recently: when you’re stuck, write it down.

Say you’re trying to figure out how to do something in [pick a framework], and you’ve Googled the heck out of the most-likely search terms, and nothing’s coming up.

Then write down your question as if you were going to ask a teacher/email it to a friend/post to a Google group/etc. Write down all the details: explain the thing you’re trying to do, the problem you have, and the number of things you’ve tried. Be as clear as you can, but don’t worry about being concise.

Literally every single time I’ve ever done this – and my rule-of-thumb is to do it after ~1.5 days worth of trying to figure it out myself – I find a number of new avenues to try, and almost always solve the problem on my own.

Writing it down forces you to take the jumbled thoughts in your head (they probably weren’t jumbled when you started, but you’ve changed paths so many times now) and turn them into a narrative. The process makes visible paths that your random walk opened up but that you didn’t see.

(This has been a procrastination for completing a writeup of my own.)

Twitter Updates

[aktt_tweets count="5"]