4 ms·
Good Code Tells the Truth
- wccrawford 16y agoLost me when he said that saying something more than once is lying. DRY is a great principle, but not following it is not the same as lying.
- duck 16y agoFor another example of truth in coding, consider namespace pollution. An unnecessary global variable is not just an invitation to bugs; if it’s overexposed, it’s lying. Its scope should be reduced to match its importance. I think he is saying that you can't trust a global variable as it could be not what you think it is (and thus lying) because of it's scope.
- shawndumas 16y agoIf lying requires intentionality then yes you are correct.
- zipdog 16y agoI think the writer misuses the word 'Truth'. He really means something like Grice's maxims for language and communication. A couple of programmers I know have been reading philosophy (in particular epistemology) and applying principles from it to their coding - I was hoping the article would talk about how code really can be improved by making it Truthful in a stricter sense.
- shawndumas 16y agoyour blog url please. (you are blogging this code-epistemology odyssey, right?)
- zipdog 16y agooh, no I wasn't :( but if you give me a couple of weeks, I'll see if I can find time to start
- jsankey 16y agoAgreed. Although the post makes several good points, there isn't really a key insight there. The author fails to convincingly boil it all down to a single concept of "truth". Rather, it feels the term is just stretched this way and that to try and pull together separate ideas: "That means brevity. As Seneca said, “Truth hates delay.”" "An unnecessary global variable is not just an invitation to "bugs; if it’s overexposed, it’s lying" "If it’s a playlist, call it a playlist. Don’t call it a set. Tell the truth." The connection here is shallow: the author has merely found a way to work truth into each description. Maybe it's better to just accept that there are multiple axes of goodness (which further makes us realise sometimes they are in conflict).
- j_baker 16y agoI agree with this. Good code isn't always pretty. It's code that allows you to get the best idea of what it's doing.
- rpbertp13 16y agoIt is fascinating how Plato's conflation of the True, Good and Beautiful still resonates 2500 years later and in fields that are not consciously philosophical.