3 ms·
I actually don't have this problem. A lot of things programmers get hung up on is just OCD stuff that don't actually improve anything. I once named a function
by deltaonefour 5y ago
I actually don't have this problem. A lot of things programmers get hung up on is just OCD stuff that don't actually improve anything.
I once named a function
findGreatestCommonDenominatorGCDOfFraction(numerator: int, denominator: int) -> int
and one programmer wanted me to rename it into GCD(x, y) because it was more elegant. While GCD feels more elegant it's actually less clear and less practical. The length and verbosity of the function name above typically has a zero cost because of auto complete and other features you should be using in your editor.
- pkaye 5y agoWhy do you have GreatestCommonDenominator and GCD in that function name?
- deltaonefour 5y agoSearch. But even without search does having GCD in the name matter? No. It literally does not harm the program or understanding of the program in any way. Even so, the majority of programmers will have a tendency to react to this as emotionally wrong. Then they attempt to rationalize this explanation with some form of reasoning. Try to catch this in yourself as it could be happening Right now as you read this. You feel it's wrong but not from the composition of logical explanations. The feeling of wrongness forms first than you try to search for facts to rationalize your feeling. Let me be clear. There is nothing logically harmful with that name but most programmers feel there is. This type of OCD tendency accounts for about 50% requests in code reviews. Ultimately useless changes to satisfy some OCD tendency.