>In precisely defined domains it's possible to form complete ideas in your head. People can play chess in their heads, for example. And mathematicians can do some amount of math in their heads, though they don't seem to feel sure of a proof over a certain length till they write it down. But this only seems possible with ideas you can express in a formal language.<p>For me, at least, programming falls into this category of writing. The difference, however, is that when you're programming, you have <i>three audiences</i> to satisfy. They are, the <i>compiler</i> (or interpreter), the <i>problem</i> to solve, and other <i>programmers</i>. Over time, the writing becomes part of a conversation, as I'll explain below.<p>The compiler, the first audience, is the one that beginning programs bang their heads against the most. It can have any number of arcane and complex rules and interactions to learn about, and practice, before you can reliably get the compiler to accept your work as valid.<p>The problem is the audience we're paid to satisfy. It requires that you end up with a workable answer given workable inputs. Satisfying it requires getting to know it a bit, then reaching back into your toolkit of tricks to get just the right set of algorithm and code. It's more of a conversation, that settles down into an agreed upon text. As time goes on, the details become nuanced, and the corner cases handled.<p>The third audience is the humans who read the program, and those in the future (including yourself!) who might want to join the conversation. All of these people need to be able to read, and adjust, the agreed upon text, or copy it to use for some other problem. As you go, the more you keep this third audience in mind, the easier it is for them to join or even rejoin the conversation.<p>Reviewing, there are aspects of these audiences to note:<p>The compiler is fairly easy to satisfy, you can bang away at possibilities and tweak the code until it agrees that your words are valid. Then you can keep tweaking until you make it happy.<p>Note however, that the compiler can be capricious, it can radically change it's opinion of your work over time. Many a story as been written here about the shock of finding that certain words or phrases are newly irritating to the compiler, or just plain unacceptable. Python is said to have gone through this phase between v2 and v3.<p>The problem can change as well. New requirements of a wide variety can result in the need to revise the agreed upon text.<p>The third audience can vary widely. It can be just yourself for a very short time in response to a homework or programming contest problem. It can be your coworkers, past present and future. It can be the world, if the work is open source and widely useful. It can be the users of a library, who will focus narrowly on the interface you provide, while only some dare to peek at the implementation.<p>I find that the more I keep all three audience in mind, the better the outcome. Thank you Paul for the writing prompt. 8)