Literate Programming Examples
I've really become enamored with the idea of
literate programming, but figured that the best way to
re-introduce it to others is the same way Knuth did… with examples.
What does it look like to work this way?
Here are a few screenshots of my Emacs environment showing some of
these examples.
Now on to the examples. Keep in mind that each example below has an
original "ORG" file as well as derivative files:
Coin Kata
Many people have talked about the Coin Change Kata, as a way to
practice our coding craft. I thought it would be fun to try it in a
literate way, and this is the results. I suggest viewing the
web page first.
Why yes, you can keep your tests next to your code and tangle it
out to separate file(s).
Diary Template
Every day, I create a new file and enter information about my day… a
quantified self diary if you will. I keep statistics like the
weather and my diet to see what may trigger my infrequent migraines.
Emacs Init File
Being a rabid Emacs user, my .emacs
file grows regularly, and
sometimes I forget how some of the code I've added works… or even
why I added it in the first place. LP and Org (with its abilities to
have clickable hyperlinks) seemed a natural fit.
Tell others about this article: