Simple is beautiful

Complexity happens. Simplicity, you have to strive for. Here's a blog post titled Simple is beautiful, written two years ago by Noel Llopis, that includes some gems of wisdom, including several quotes that I absolutely love.

Edsger W. Dijkstra in his lecture The Humble Programmer:

The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague.

Brian Kernighan:

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.

The one bit that I want to add to is the "Timings, logging, and error handling" section. In it, Noel asks:

Ideally, I'd like my code to be really small, simple, and to the point so its meaning is always clear and obvious. Unfortunately, in the real world, that's is not always possible. We can start with a very clean 5-line function, but then we add timings around it to get an idea of its performance, and logging statements to know what is going on, and error handling code to deal with the unexpected, and before we know it, we have a monster function whose meaning is lost in a mass of details. . . What can we do about it?

The solution is to implement these cross-cutting concerns using Aspect-Oriented Programming (AOP).

Read Noel's full post here.

Comments