|
|
|
|
|
by engmgrmgr
1618 days ago
|
|
Effort to refactor is something to consider, and verbosity makes this harder as you get lower level. Another thing to consider is the very verbose names can be something that people actively avoid for clean code, and you could end up with spaghetti code to make it both readable and verbose (imagine someone doing this for years and then handing the code off to someone when they leave because they were so pigeonholed in that system that no one else could easily collaborate). Downstream, you can end up with tech debt instead of optimally refactored code as people struggle to do something of a smaller scope. And if every tiny thing is unit tested, it gets even harder to change without expanding the scope of work. Math code is an extreme example of where verbosity can quickly become detrimental. |
|
"Clean" code is often an excuse for lazy, short names which need a comment to explain them. Consider this completely fabricated example:
// calculates the area of a rectangle with sides a and b, u being true for metric, false for imperial
int rarea(int a, int b, bool u);
versus
int rectangle_area(int side_a, int side_b, bool metric);
which more or less doesnt even need a comment anymore.
"Clean code" people want short names, massive comments that can be collapsed, so that from really far away, it looks neat. Its a terrible beginner mistake I see time and time again, and it shouldnt be defended.
If you write a math formula, how is writing "side_a" or "phi" worse than "a" and "p"?