Create a gist now

Instantly share code, notes, and snippets.

@jmewes /notes.md Secret
Created Jun 2, 2018

Embed
Literate Programming

https://www.youtube.com/watch?v=zYHsQarGaQ8

Donald Knuth, 2016, R Conference

Motivation

  • consider computer programs as literature

  • idea is to find the best way to explain a program to a human being

  • writing a program optimized for human readability first, compiler readability second.

Basic ideas

  • publication of computer programs as a book
  • think of a program as a hypertext
  • complexity from composition of lots of small simple parts
  • Small simple modules, connected to small other modules

Advantages

  • Diagrams, tables etc. can be kept beside the code
  • code may get rewritten when it is correct but difficult to explain
  • code can be understood by human beings
  • pedagogical style
  • also include design descisions
  • time saving comes from debugging through better understanding
  • May make some sort of very complex programs possible at all by reduction of congnitive load.

Disadvantages

  • a lot more work
  • more difficult to create

Examples

A Retargetable C Compiler: Design and Implementation, Christopher Fraser

  • This book is the implementation of LCC

Understanding MP3, Martin Ruckert

  • This book includes a complete MP3 player
  • You can zoom in on all the details if you want

Physically Based Rendering, Matt Pharr, Greg Humpherys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment