News for hackers. Stuff that matters.
Re:What Makes Code Hard to Read: Visual Patterns of Complexi... by harrison_clarke on Tuesday March 11, 2025 @05:41PM (#43337344)
you have this backwards: reusing code couples the code. copy+paste uncouples code

if you have two functions, they're not coupled. you change one, the other stays as-is

if you refactor it so that they both call a third function, they're now coupled. you can't change the part they have in common without either changing both, or uncoupling them by duplicating the code

(you often want that coupling, if it lines up with the semantics)

Re:What Makes Code Hard to Read: Visual Patterns of Complexi... by ninetyninenine on Tuesday March 11, 2025 @08:54PM (#43338858)
I meant code within the snippet is tightly coupled. You can't just cut the for loop in half and reuse half the logic.