Adages about the Practical OCaml Programmer

  1. The practical OCaml programmer first seeks to understand what is going on. They write unit tests to concretize their understanding.
  1. The practical OCaml programmer then seeks to understand how things work. They study the nature of the data at hand and keep in mind that there is no need to re-invent the wheel.
  1. The practical OCaml programmer uses structural recursion for data that were constructed inductively. And so when faced with a structurally recursive computation, they first specify it inductively.
  1. The practical OCaml programmer heeds the reverse order of accumulation.
  1. The practical OCaml programmer is not afraid of anonymous functions.
  1. The practical OCaml programmer shuns gratuitous variations as a waste of brain cycles. They have realized that the uniformity of how they do things fosters a unity in what they do.
  1. The practical OCaml programmer is wise to the fact that paraphrasing how a program works does not explain what this program does.
  1. The practical OCaml programmer knows that a commented code listing does not a report make, and that the measure of their understanding is the clarity of their discourse.
  1. The practical OCaml programmer learned that the road to simplicity is full of bumps.
  1. The practical OCaml programmer doesn’t always start from nothing. They try to start from what they have already done.
  1. The practical OCaml programmer interacts with the OCaml toplevel loop in a minimal way. They use the file system for long-term storage. (This way, they can start from what they have already done.)
  1. The practical OCaml programmer chooses meaningful names and uses auto-completion.
  1. The practical OCaml programmer rejoices at their mistakes as an opportunity to learn, since to learn from our mistakes, we first need to make mistakes.
  1. When the practical OCaml programmer does not find an error somewhere (e.g., in their program), they look somewhere else (e.g., in their unit tests).
  1. The practical OCaml programmer is aware that as pointed out by Edsger Dijkstra, incomplete testing only proves the presence of errors, not their absence, since it cannot enumerate all possible cases, even when it provides branch coverage. They further know that since complete testing enumerates all possible cases, it does prove the absence of errors.
  1. The practical OCaml programmer lives by Don Knuth‘s tenet that early optimization is the source of a lot of evil, and by Kent Dybvig‘s patient observation that often, nothing needs to be made efficient if it is done right in the first place.

Version

Mentioned branch coverage [11 May 2022]

Reshuffled the adages [30 Mar 2022]

Added the bit about uniformity paving the way to unity [29 Mar 2022]

Added index entries [29 Mar 2022]

Renamed this chapter [26 Feb 2022]

Expanded the last adage [01 Feb 2022]

Created [14 Jan 2022]

Table Of Contents

Previous topic

Food for thought to take home

Next topic

More Sayings about the Practical OCaml Programmer