4 ms·
> It's unlikely that Kernighan meant it takes someone twice as smart to figure out what you were doing no, that is exactly what he meant. clever code means you
by fargle 2y ago
> It's unlikely that Kernighan meant it takes someone twice as smart to figure out what you were doing
no, that is exactly what he meant. clever code means you are just barely able to understand it enough to write it yourself [in any amount of time]. therefore, you aren't going to be able to debug it at all, by a factor of nearly two. and if you are the "smartest" person in the org (which he often was), then you are really in big trouble.
now obviously things in the real world like "smart" and "clever" are not one-dimensional quantities in neat categories, but he was making a memorable and funny quote, with quite a bit of truth to it, not a precise scientific hypothesis.
see also: "too smart for one's own good"
> nonsensical interpretation
how so?
> someone twice as smart may not be able to figure out what the stupid person is trying to do in the first place if the code written was nonsensical.
true, but irrelevant, this is about clever code from a smart person, not nonsense code from a stupid one.
- vlovich123 2y agoThe Linux kernel for example is filled with code that is at the limit of cleverness of the people who came up with it (e.g. RCU or intrusive linked lists). Turns out that once a concept is introduced, people can absorb it and become smarter. It’s just simply categorically not true that something written at the limit of your cleverness at one time prevents you from being able to debug it because cleverness is not something fixed and static.
- fargle 2y agoagree, but as i said: "he was making a memorable and funny quote, with quite a bit of truth to it, not a precise scientific hypothesis" never-the-less there is still a lot of truth to the saying, nobody said it was universally categorically true. i've written clever code when it needs to be clever, for example performance. along the lines of the RCU code. when i do i plan for handling the complexity - static analysis or exhaustive testing if possible. suddenly needing to advance your cleverness by 2x isn't impossible, but it's not fun if your butt is on the line.
- vlovich123 2y agoSure. I wasn’t advocating for making all your code clever. But clearly super clever code doesn’t make code magically not debuggable. It may not be fun to touch but usually you just make sure it’s well tested, documented, & then you try to never touch it again.