coding simplicity meme

One of my students did something similar (hardcoded formulas for 3x3 matrix multiplication instead of using loops). I gave him full credit, as his code was correct and readable.

Nowhere did the assignment ask to scale to arbitrary dimensions, and around 20% of the class (“C as the first language for non-CS students”) had bugs doing it via nested loops.

For the new students, I believe the bug rate in inlining would be less than 20% of the nested loops I’ve observed, as

  • they are used to math formulas, while loops were a new concept.
  • same with eyeballing indices vs thinking iteratively.

20 years ago, this case got me thinking about bug probabilities and eventually led to my interests in software entropy and longevity.