C.R.A.W.LAB Etouffee

Delicious Bytes of Information

Literate Programming

I’ve talked with many of my students about first writing out their programs in “plain English” before writing a single line of code. The motivating idea is that if you are unable to clearly describe the algorithms and code you want to write in plain English, then you are not going to be able to write the code itself. For problems of sufficient complexity, I will not only do this, but will also write the comments of the code before the code itself.

There’s actually a style of coding that more-formally proposes a version of this method. It's called Literate Programming and was first proposed by well-known computer scientist Donald Knuth1. The Jupyter Notebook and Swift Playgrounds also strive to perform a similar service for the programmer, making understanding written code easier and by doing so, also making it easier to write high-quality code and/or learn how to code.

  1. Dr. Knuth was also the inventor of TeX, the typesetting language used by LaTeX