Re:Hard-to-swallow truths they won't tell you about software...
by gizmo on Wednesday November 08, 2023 @12:16PM
(#38193584)
I really doubt there is any such consensus. Some people really care about superficial code quality (good variable names; short functions; consistent formatting and documentation; compiles without warnings). Other programmers care mostly about architectural quality (shallow call stacks; correct data structures; few dependencies and little scaffolding).
Re:Hard-to-swallow truths they won't tell you about software...
by f1shy on Wednesday November 08, 2023 @12:29PM
(#38193811)
As stated in the previous comment, if you give code from group A to group B, they will tell you “I would prefer this and that, but still seems clean to me”
Re:Hard-to-swallow truths they won't tell you about software...
by gizmo on Wednesday November 08, 2023 @12:56PM
(#38194247)
I don't agree. I know what the previous comment said.
Modern C++ codebases that make extensive use of templates, inheritance, exceptions, type coercion, closures are considered clean by many because the code looks nice. But code like that can be a nightmare to work with, because of long compile times, spooky action at a distance, etc.
Take these two files from LLVM:
https://github.com/llvm/llvm-project/blob/main/libcxx/includ...
https://github.com/llvm/llvm-project/blob/main/libcxx/includ...
Is this "clean code"? I'm confident there will be absolutely no consensus.
I disagree. I'll take a bet that given 10 experienced software engineers (we can define what this means -- title, years of experience, familiarity with language idioms, etc.) they'll mostly agree on samples A, B, C, ... of code if it's "clean" or not.
Code doesn't have to follow my preferred design pattern to be clean. The bar is don't be shitty, and I'll know shitty code when I see it[1].
1 - https://www.wsj.com/articles/BL-LB-4558