Hacker News new | past | comments | ask | show | jobs | submit login
Good Code Tells the Truth (pragprog.com)
25 points by duck on Oct 6, 2010 | hide | past | favorite | 9 comments



I 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.


Agreed. 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).


your blog url please. (you are blogging this code-epistemology odyssey, right?)


oh, no I wasn't :(

but if you give me a couple of weeks, I'll see if I can find time to start


Lost 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.


For 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.


If lying requires intentionality then yes you are correct.


I 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.


It 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: