I've been doing it wrong, all this time.
I used to believe that I designed before coding, but I was just thinking about it in general. Thoughts have curious properties: we believe they're perfect and solid in our minds, yet we often struggle to express these perfect, beautiful things. And
it's not just me. Ideas are actually fluffy, vague, and prone to being silently forgotten as you're trying to work on them.
I've tried writing things down in the past, but paper doesn't work for me for coding. It just takes too long to write down enough to be caught up with myself, and by then, I've forgotten where I was going with things. On the other hand, I've never been disciplined enough to design in a text editor without jumping into coding too soon.
This week, I started using a word processor as part of the process. It works much faster than writing text on paper, and it's a lot more flexible. I can copy/paste a huge block of code, or compile a rough execution-trace, and edit the result without worrying about damaging any real code or dirtying the diff. The text styles allow for coloring certain variables, or adding bold to a problematic region. Zooming out is also more elegant than shuffling paper.
The most surprising advantage is that it's faster to write the design than write the code, because the code is frequently split between libraries or functions, and there's a lot of effort spent in keeping track of where the code that needs changed is. Obviously (in retrospect, anyway) that conflicts with keeping the pending changes in mind. Since the document also survives distractions, it helps with keeping me focused, too.
I worried at first that being unable to draw would be a major hindrance, but for coding, it's a helpful constraint. Images are much closer to thoughts in their ability to seem complete, yet lack real detail. Condensing the requirements and plan of attack down into text provokes the study of those elusive details, and brings the important ones into sharp relief. With the vital parts marked in color or bold, it's much harder to gloss over that
one little spot that would normally stop me only after getting most of the way through changing all the code to a broken design. It wouldn't work out so well for visual designs like
nQn's new logo, but it's been great so far for coding.