4 ms·
I don't think it's underrated; it's that it's hard to write. You almost go full-circle. You start off writing highly procedural code (with too much branching),
by zamalek 9y ago
I don't think it's underrated; it's that it's hard to write.
You almost go full-circle. You start off writing highly procedural code (with too much branching), join the GOF-all-the-things religion and eventually revert to highly procedural code (more specifically "algorithmic code" or "functional code").
As an example, many years ago I wrote a dependency resolver. It needed to find cycles (as we had some rules that could resolve those cycles) in order to make changes in the correct order. At the time I was a junior developer in that problem space. My solution consisted of an O(scary) algorithm; consisting of classes, patterns and all the good things that make your code "simple" and "understandable" (it was not). Customers eventually threw graphs with a few million edges at it and we needed a new solution. I have no idea how I happened upon Tarjan's Strongly Connected Components Algorithm but some hundreds of lines of code was replaced with dozens. Minutes turned into milliseconds.
Here's the thing about simplicity: even though the code was simple, even I (as the author) didn't understand it at the time - I trusted the guy with the PHD. Many years later I finally understand how it works. It is an incredible masterwork of simplicity but as it turns out something that is simple is not always understandable.
Simplicity probably has a simple definition in the dictionary, but in practice it can be quite complex to make something simple. So you can't just say "make your code simple" because it's really hard to do that.
- hyperion2010 9y agoSimplicity is the answer without the question.
- lestertj 9y agoI agree. There seems to be two interpretations of "simple" - simple in being concise like that of a beautiful mathematical equation, or simple in being easy to follow and understand. I assume the latter is preferable when factoring in having other pairs of eyes reading/maintaining your code, especially since the latter does not always imply less efficient code
- etherealG 9y agoActually, I think the interpretation of simplicity as ease is an awful thing in the context of programming and should be actively discouraged. Rich Hickey’s talk “simple made easy” is the best explanation I’ve ever seen of this.
- dood 9y ago“I didn't have time to write a short letter, so I wrote a long one instead.” - Mark Twain It's both hard and underrated - it's underrated because it's so hard that a lot of developers haven't developed the skill of writing simple code, and so don't recognize the value when others do it.