Hacker News new | ask | show | jobs
by tariq 5229 days ago
cool, and here i thought i was alone in needing to take time to name things correctly.

had to name a variable earlier this week and even broke out the thesaurus. best i could muster was years_experienced_absolute :/

1 comments

Sometimes when I have trouble coming up with a good name it's a sign that I need to rethink the surrounding code as well.

Since naming is hard, I try to minimize the number of names I create. I think the number of names in a codebase is a measure of complexity.

Names are also critical to understanding.

It's very similar to the phenomenon of notation (including maths, sciences, and, yes, programming languages themselves):

"By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and, in effect, increases the mental power of the race." -- P Davis and R Hersh The Mathematical Experience (Boston 1981).

I know that my team spends an inordinate amount of time debatting the names of concepts. We've found that, since we're trying to build something unique, there aren't always words for the concepts we're building. Worse yet, there are words that are close, but not quite right! It's extremely difficult to write any code before everyone can hear a word and reach a common mental image. I've found that if you get the right names, the code is so much easier to write and reason about.

Sometimes though, not finding good names might just be an indication of the newness or non-standardized nature of the situation you are using the name in. Even in natural languages, there are concepts/situations which have names in one language and must be described using sentences in others. Trying to fit something into the currently popular wordlist might then be an artificial requirement.
exactly.