Brian Kernighan: The Elements of Programming Style

How to write good code, from one half of K&R C.

Video of talk at Institute of Advanced Study. Seemed to be given to computational astrophysicists?

Lead-in

~2:20: FORTRAN code example (identity matrix)

3:44: Introduces book he co-wrote called The Elements of Programming Style, first published in 1974. Takes bad code, improves it and derives a rule from that. The examples in that book are super-old but the talk takes the same approach, using more recent code examples. The principles of how to write well haven’t changed — only the details.

The Elements of Programming Style

Bottom line:

Say what you mean, simply and directly. Write as clearly as you can.