A recipe for literate programming

A recipe for literate programming

keywords: literate programming, recipe.

Think about the program: the problem it solves, and the structure.

Go for a walk. Do the dishes. Watch some TV.

Go back and think about the program.

Think about it some more.

Stop thinking about it again. Let your subconscious handle it for a bit.

Do you have an idea what structure of the program will be like? Talk it over with yourself. Make you sure agree with them.

On second thought, nevermind. Think about it some more. What problem does it really need to solve? How does it do it? What is the structure and flow of the program?

Mumble to yourself a bit more. That's it. Fully formed complete sentences. Good. Time to write those articulate mumbles down.

Begin writing. Talk about the program. Write in 1-2 sentence chunks. Don't worry about order here. Aim for self-contained nuggets.

Keep writing until everything you know about the program is written down.

Edit. Move things around. Make it flow. Begin thinking about what the code is going to look like. You're about to write some code.

You know what? The code can wait. Go back and look at your writing. It should feel like a complete description of the program. Is there anything missing? See any edge cases or complications? Nows a good chance.

Write some initial boiler plate code. The flow should on average alternate between words and code. Use named code blocks to bend the code structure to the natural language structure.

Stop thinking about the program and do something else for a bit. I've heard good things about that new show on Netflix.

Get ready to write some more code. Skim through the words you have written. Edit where needed. A literate program is not just optional documentation, it is how the program is consumed and understood.

Take breaks. Review. Edit. Code. Repeat until the program is fully realized.


home | index