|
|
|
|
|
by akkartik
5238 days ago
|
|
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. |
|
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.