I have a large function to write over the weekend. When it's finished and a co-worker gives the all-clear after his tests are complete, I'll unleash it on the documentation notebooks for the upcoming version of Mathematica and let it do its thing. My function will store blobs of information in each notebook, and my co-worker's function will use those blobs to build other parts of the notebooks.
This time around, though, I'm doing something a bit different that's working remarkably well so far. I started with an empty function template and simply wrote the function's story in sentences and paragraphs and bulleted lists, from start to finish, as if I were describing it in detail to a technically-minded co-worker. In a second pass I broke apart the prose into smaller sections and then just translated each idea into Mathematica code. I've left the prose in there as free-form commented areas to act as documentation for my future self, who will have forgotten all about this code in a couple of years.