4 ms·
I think there's a real smell with those long, dense lines of code. Tends to mean your data structures are out of control: objects with arrays that point to othe
by whynotminot 4y ago
I think there's a real smell with those long, dense lines of code. Tends to mean your data structures are out of control: objects with arrays that point to other objects that then also have arrays on them. My oh my.
Comments being required are also another smell that the code doesn't explain itself. I know this is said so often it's a cliche, but it really is true.
I think both of these things point back to the same problem: out of control data structures.
- guenthert 4y agoSure, if the computer can figure out what a given fragment of code is supposed to do, so can you (a sufficiently clever programmer). The question rather is, do you spend 20s reading a comment or 15m to solve the riddle? There's a real danger that comments aren't updated when code is, particularly if 3rd parties make those changes. This is one of the corners where there will never be a single answer which is right in all circumstances.
- ethbr0 4y ago> There's a real danger that comments aren't updated when code is, particularly if 3rd parties make those changes. So much this. If it took you everything you learned over the last week + an epiphany to come up with a bit of code, how is someone scanning through supposed to understand it? Or, in example with hilariously apropos incomplete post-hoc comments, 0x5F3759DF https://en.m.wikipedia.org/wiki/Fast_inverse_square_root#Overview_of_the_code https://en.m.wikipedia.org/wiki/Fast_inverse_square_root#Ove...
- BurningFrog 4y agoOften, breaking out a well named variable or three is the better way to make code readable.
- ParetoOptimal 4y ago> There's a real danger that comments aren't updated when code is, particularly if 3rd parties make those changes That problem exists because no one denies pull requests or rejects code that has outdated comments.