Clear is better than clever [pdf]
It's interesting that the comparator function is one of the examples, because that's something which shows how people often confuse <i>verbose</i> with <i>clear</i>; I think it's best written in a single line:<p><pre><code>    return a < b ? -1 : a > b ? 1 : 0;
</code></pre>
That's one line, compared with the 10(!) of his proposed method using a switch statement. Having worked with some "modern" codebases, I think verbosity is a bigger problem that's become especially prevalent recently, since the idea of making a simple thing simple is so enticing and easy, but emphasising "micro-readability" to that extent (that's 10 lines of code for two simple decisions) will bloat the code and make "macro-readability" harder, and it's the latter that really matters for the understanding of complex software.<p>Anyone who has the experience of reading lots of highly trivial functions like those, and gotten the feeling "I've read a <i>lot</i> of code, and I understand what each little bit does, but what is the whole thing trying to do?" That's a symptom of excessive verbosity.<p>To offer another (subjective) point, I think the lack of semicolons or other statement delimiters does make code harder to read, as it makes it look similar to a run-on sentence. Natural languages have punctuation for a similar reason --- you can quickly scan over sentences by finding their delimiters.<p>Also, the counterargument: <a href="https://www.linusakesson.net/programming/kernighans-lever/index.php" rel="nofollow">https://www.linusakesson.net/programming/kernighans-lever/in...</a>