| I agree. I can't find it right now, but there was an article on HN within the past few days talking about how software engineering is often more like writing and editing a book than engineering. That makes perfect sense to me. Code should be meant primarily to communicate with people, and only incidentally to give instructions to computers. It seems to be lost to the sands of time who said this first, but it is certainly true that code is read by humans many more times than it is written. Therefore, ceteris paribus, we should optimize for readability. Readable code is often simple code, as well. This also has practical benefits. Kernighan's law[0] states: > 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. Dijkstra says it this way: > 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.[1] Knuth has a well-documented preference for "re-editable" code over reusable code. Being "re-editable" implies that the code must be readable and understandable (i.e. communicate its intention well to any future editors), if not simple. I know that I have sometimes had difficulty debugging overly clever code. I am not inclined to disagree with the giants on this one. --- [0]: https://www.defprogramming.com/q/188353f216dd/ [1]: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD03xx/E... |