code readibility

Two definitions, from one of the best courses I’ve taken.¹

  • syntax: the rules that say what counts as valid code. punctuation, keywords, structure
  • semantics: what that code means. what it does, what it represents

So readability is syntax that makes semantics obvious.

  • not imperative versus functional
  • not tabs, spaces, or where the braces go
  • whether a value is being moved or copied
  • whether I’m holding a reference or the thing itself
  • whether a loop mutates what it touches or leaves it alone

A good language makes semantics obvious. A good programmer does it anyway, when the language won’t.

¹ CS3110, Cornell’s OCaml course.